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

Chore/demo customer #509

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Chore/demo customer #509

wants to merge 6 commits into from

Conversation

ataideverton
Copy link
Collaborator

What's the purpose of this pull request?

How does it work?

How to test it?

Faststore related PRs

References

Copy link

vercel bot commented Aug 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
starter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2024 0:12am

ataideverton added a commit to vtex/faststore that referenced this pull request Sep 16, 2024
## What's the purpose of this pull request?

As we develop more b2b features inside the `faststore`, we need to be
able to identify when a customer is a `b2b` customer and if he is member
of an Organization (Normally refered to as a Buyer Organization). This
PR addresses the first step to do so.

For that, we added a `b2b` section to the `session` hook and mutation
and inside of it, a `customerId` field, that informs us of what
BuyerOrganization that customer is a part of.

Why we decided to do this inside FastStore and not as an override or
extra request: The information comes from the same `sessions` api
`Faststore` already uses, we just need to bring an additional field.
This will not impact B2C stores, for them, it will only be an empty
objetct

## How it works?

On a B2B account that fulfills several conditions (Some specific apps,
some specific versions of apps, a feature flag), the `sessions` api will
return the `customerId` field on the `authentication` namespace and that
will be inserted on the internal session object, like so:

Account:  `b2bfaststoredev`: 

![image](https://github.com/user-attachments/assets/88ed84f8-0b62-406c-8596-931e09ca799d)



On a B2C account, or any account that doesn't fit all the criteria, the
field will be empty and should not interfere with anything.

Account: `storeframework`

![image](https://github.com/user-attachments/assets/81dbb28c-7561-4bf9-ae56-f3a57846e9c6)


## How to test it?

To make validation easier, we have 2 previews (You will need to be
logged in to see it working, as they are previews, you will need to edit
the cookie):
[B2B Preview - Session will print on console every few seconds, only on
the /self-management
page](https://sfj-45b4ae2--b2bfaststoredev.preview.vtex.app/self-management)

[B2C Preview - Has a button on navbar to print the session on
console](https://sfj-342a275--starter.preview.vtex.app/)
The button and the `faststore/cli` dependency are the only changes here

The PRs for these previews: 
[B2B](vtex-sites/b2bfaststoredev.store#91)
[B2C](vtex-sites/starter.store#509)
ataideverton added a commit to vtex/faststore that referenced this pull request Oct 3, 2024
## What's the purpose of this pull request?

As we develop more b2b features inside the `faststore`, we need to be
able to identify when a customer is a `b2b` customer and if he is member
of an Organization (Normally refered to as a Buyer Organization). This
PR addresses the first step to do so.

For that, we added a `b2b` section to the `session` hook and mutation
and inside of it, a `customerId` field, that informs us of what
BuyerOrganization that customer is a part of.

Why we decided to do this inside FastStore and not as an override or
extra request: The information comes from the same `sessions` api
`Faststore` already uses, we just need to bring an additional field.
This will not impact B2C stores, for them, it will only be an empty
objetct

## How it works?

On a B2B account that fulfills several conditions (Some specific apps,
some specific versions of apps, a feature flag), the `sessions` api will
return the `customerId` field on the `authentication` namespace and that
will be inserted on the internal session object, like so:

Account:  `b2bfaststoredev`: 

![image](https://github.com/user-attachments/assets/88ed84f8-0b62-406c-8596-931e09ca799d)



On a B2C account, or any account that doesn't fit all the criteria, the
field will be empty and should not interfere with anything.

Account: `storeframework`

![image](https://github.com/user-attachments/assets/81dbb28c-7561-4bf9-ae56-f3a57846e9c6)


## How to test it?

To make validation easier, we have 2 previews (You will need to be
logged in to see it working, as they are previews, you will need to edit
the cookie):
[B2B Preview - Session will print on console every few seconds, only on
the /self-management
page](https://sfj-45b4ae2--b2bfaststoredev.preview.vtex.app/self-management)

[B2C Preview - Has a button on navbar to print the session on
console](https://sfj-342a275--starter.preview.vtex.app/)
The button and the `faststore/cli` dependency are the only changes here

The PRs for these previews: 
[B2B](vtex-sites/b2bfaststoredev.store#91)
[B2C](vtex-sites/starter.store#509)
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

Successfully merging this pull request may close these issues.

1 participant