Skip to content

feat: Update Session with location info - #2749

Merged
lariciamota merged 8 commits into
feat/delivery-promisefrom
feat/session-facets
Apr 8, 2025
Merged

lariciamota merged 8 commits into
feat/delivery-promisefrom
feat/session-facets

Conversation

@lariciamota

@lariciamota lariciamota commented Mar 27, 2025 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature. FastStore updates the session with the location information and IS access it.

How it works?

The update is a PATCH request to the Session Manager API. The fields that IS will use from the session are postalCode, geoCoordinates and country, inside the public namespace.

How to test it?

Run this code (or use the preview link below) and test changing the postal code and/or using a default one.
The fields inside public namespace of the session should be updated accordingly.
To check it you can run this request:

curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'

⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can get in the browser

Preview with Delivery Promise NOT enabled

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

Screenshot 2025-03-28 at 11 47 29
Screenshot 2025-04-07 at 08 43 45

Preview with Delivery Promise enabled

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/

Without postal code set

The session shouldn't update the public field.

Screenshot 2025-03-28 at 12 08 36
Screenshot 2025-04-07 at 08 45 10

With postal code (and country and geo coordinates)

The session should update the public field!

Screenshot 2025-03-28 at 12 09 28
Screenshot 2025-04-07 at 08 45 57

Starters Deploy Preview

https://github.com/vtex-sites/starter.store/pull/737

References

@lariciamota lariciamota added the enhancement New feature or request label Mar 27, 2025
@lariciamota lariciamota self-assigned this Mar 27, 2025
@codesandbox-ci

codesandbox-ci Bot commented Mar 27, 2025 •

Copy link
Copy Markdown

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.

@lariciamota
lariciamota force-pushed the feat/session-facets branch from 92e616f to 86d6dae Compare March 27, 2025 18:20
@lariciamota
lariciamota marked this pull request as ready for review March 28, 2025 15:18
@lariciamota
lariciamota requested a review from a team as a code owner March 28, 2025 15:18
@lariciamota
lariciamota requested review from lucasfp13 and renatamottam and removed request for a team March 28, 2025 15:18
@lariciamota
lariciamota changed the base branch from feat/delivery-promise to main March 28, 2025 15:21
@lariciamota
lariciamota changed the base branch from main to feat/delivery-promise March 28, 2025 15:22
@lariciamota
lariciamota force-pushed the feat/session-facets branch from d9b57ce to 1686b6b Compare March 28, 2025 15:23
@lariciamota
lariciamota force-pushed the feat/delivery-promise branch from 3825b3c to 9742ded Compare March 28, 2025 15:27

@lucasfp13 lucasfp13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected 🚀
Screenshot 2025-04-03 at 17 54 00
Screenshot 2025-04-03 at 17 55 02

@lariciamota lariciamota changed the title feat: Update Session with location facets feat: Update Session with location info Apr 7, 2025
return null
}

await updateSessionWithLocation(clients, newSession, enableDeliveryPromise)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lari, vendo a implementação e também a doc de sessions fiquei com a percepção que a implementação pode ser mais sofisticada para ser otimizada tbm, então alguns pontos:

  1. A definição do newSession não deveria incluir também o postalCode para todos esses parametros serem considerados no deepEquals?
  2. Na linha 120 o client de session tem o params que se você adicionar esses 3 novos campos nele, mesmo indo como query string eles vão fazer parte do public então o create da session já volta com eles sem precisar do update depois
  3. Outro ponto sobre esse client da linha 120, ele sempre faz POST mas de acordo com a doc se ja temos os cookies setados na request parece que seria ideal ele ter uma logica de fazer PATCH, dessa forma vc não precisaria de um novo client e toda atualização ja aconteceria ali naquele momento
  4. A app checkout-session já implementa a logica de setar o regionId baseado no recebimento do postalCode, country, geoCoordinates então acho que podemos remover a implementação da linha 112 a 119 eliminando mais uma request desse fluxo
  5. essa app do checkout parece tbm ja setar endereço baseado no cliente logado que pelo que entendi seria uma outra task de vocês

@lariciamota lariciamota Apr 7, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oie, pala! Obrigada pelos pontos levantados!

1 - postalCode é incluído no newSession pelo ...oldSession da linha 131
2 e 3 - boa ideia!! Vou dar uma analisada nisso agora
4 - Interessante! Para esse ponto vou criar uma task no board do time para não misturar muito as coisas nesse PR.
5 - Sim, foi feita uma lógica para pegarmos o endereço salvo do shopper (PR), vou criar uma task no nosso épico de Delivery Promise para analisarmos isso também, se seria possível utilizar o que checkout já está fazendo para simplificarmos!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 e 3 feitos aqui

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 - Atualizei para que a gente pegue o regionId através da session aqui, mas para poder eliminar a necessidade dessa request para o checkout também precisamos analisar essa questão dos sellers que é outra info que estamos recebendo através dessa request e que não recebemos por session. Task criada sobre isso aqui.

5 - Conforme conversamos por DM, infelizmente não temos o necessário através de checkout para eliminarmos a necessidade da request para pegar os endereços salvos através da API de profile system, portanto como já validamos essa questão, não vou criar uma task sobre isso.

@gabpaladino gabpaladino left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lariciamota added a commit that referenced this pull request Apr 8, 2025
## What's the purpose of this pull request?

The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

## How it works?

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

## How to test it?

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request Apr 11, 2025
## What's the purpose of this pull request?

Update the Session with postal code, country, and geo-coordinates. 
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

## How it works?

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

## How to test it?

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

#### Preview with Delivery Promise NOT enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

#### Preview with Delivery Promise enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
##### Without postal code set
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

##### With postal code (and country and geo coordinates)
The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

### Starters Deploy Preview
https://github.com/vtex-sites/starter.store/pull/737

## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request Apr 11, 2025
## What's the purpose of this pull request?

The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

## How it works?

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

## How to test it?

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request Apr 22, 2025
## What's the purpose of this pull request?

Update the Session with postal code, country, and geo-coordinates. 
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

## How it works?

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

## How to test it?

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

#### Preview with Delivery Promise NOT enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

#### Preview with Delivery Promise enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
##### Without postal code set
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

##### With postal code (and country and geo coordinates)
The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

### Starters Deploy Preview
https://github.com/vtex-sites/starter.store/pull/737

## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request Apr 22, 2025
## What's the purpose of this pull request?

The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

## How it works?

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

## How to test it?

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request May 8, 2025
## What's the purpose of this pull request?

Update the Session with postal code, country, and geo-coordinates. 
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

## How it works?

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

## How to test it?

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

#### Preview with Delivery Promise NOT enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

#### Preview with Delivery Promise enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
##### Without postal code set
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

##### With postal code (and country and geo coordinates)
The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

### Starters Deploy Preview
https://github.com/vtex-sites/starter.store/pull/737

## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request May 8, 2025
## What's the purpose of this pull request?

The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

## How it works?

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

## How to test it?

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request May 12, 2025
## What's the purpose of this pull request?

Update the Session with postal code, country, and geo-coordinates. 
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

## How it works?

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

## How to test it?

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

#### Preview with Delivery Promise NOT enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

#### Preview with Delivery Promise enabled
https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
##### Without postal code set
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

##### With postal code (and country and geo coordinates)
The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

### Starters Deploy Preview
https://github.com/vtex-sites/starter.store/pull/737

## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request May 12, 2025
## What's the purpose of this pull request?

The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

## How it works?

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

## How to test it?

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request May 13, 2025
## What's the purpose of this pull request?

Feature branch for the Delivery Promise feature - phase 1 (navigation
based on shopper location).

- #2708 
- #2728
- #2739 
- #2745 
- #2749
- #2750
- #2768
- #2772 
- #2775
- #2809
- #2817 
- #2824 
- #2835

## How it works?


## How to test it?


### Starters Deploy Preview


## References
- [Jira epic](https://vtex-dev.atlassian.net/browse/SFS-1696)


## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
- [ ] TODO: Request Doc for PopOver
- [ ] TODO: Remind to run cms sync in the default account when the
feature branch is merged since new section was added. (And add the new
section in the admin!)

---------

Co-authored-by: Lucas Feijó <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
lariciamota added a commit that referenced this pull request May 13, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request May 13, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request May 13, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request May 13, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request May 14, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request May 14, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request Jun 20, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request Jun 20, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request Jun 20, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request Jun 20, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lucasfp13 pushed a commit that referenced this pull request Jun 20, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lucasfp13 pushed a commit that referenced this pull request Jun 20, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lucasfp13 pushed a commit that referenced this pull request Jun 20, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lucasfp13 pushed a commit that referenced this pull request Jun 20, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request Jun 23, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request Jun 23, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
lariciamota added a commit that referenced this pull request Jul 2, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
lariciamota added a commit that referenced this pull request Jul 2, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
hellofanny pushed a commit that referenced this pull request Jul 2, 2025
Update the Session with postal code, country, and geo-coordinates.
The Intelligent Search will use this for the Delivery Promise feature.
FastStore updates the session with the location information and IS
access it.

The update is a PATCH request to the Session Manager API. The fields
that IS will use from the session are `postalCode`, `geoCoordinates` and
`country`, inside the `public` namespace.

Run this code (or use the preview link below) and test changing the
postal code and/or using a default one.
The fields inside public namespace of the session should be updated
accordingly.
To check it you can run this request:
```curl
curl --location 'https://storeframework.vtexcommercestable.com.br/api/sessions?items=public.postalCode,public.geoCoordinates,public.country' \
--header 'Cookie: vtex_session=ADD_HERE'
```
⚠️ Substitute the "ADD_HERE" with the vtex_session cookie that you can
get in the browser

https://storeframework-cm652ufll028lmgv665a6xv0g-lqicw1ez2.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 11 47
29](https://github.com/user-attachments/assets/5796d143-becf-4141-8751-e7bbab93821e)
![Screenshot 2025-04-07 at 08 43
45](https://github.com/user-attachments/assets/6ab9e4ed-268a-437c-9cdb-2bc29628defc)

https://storeframework-cm652ufll028lmgv665a6xv0g-58v0e6a7h.b.vtex.app/
The session shouldn't update the public field.

![Screenshot 2025-03-28 at 12 08
36](https://github.com/user-attachments/assets/11ed56f9-1836-4da1-95f4-1b1b5bfdafc2)
![Screenshot 2025-04-07 at 08 45
10](https://github.com/user-attachments/assets/3c44b25c-73ac-4554-a7c1-a7455fe61492)

The session should update the public field!

![Screenshot 2025-03-28 at 12 09
28](https://github.com/user-attachments/assets/7e85d0cc-c676-403b-89db-6e5bffcdbada)
![Screenshot 2025-04-07 at 08 45
57](https://github.com/user-attachments/assets/29ec6991-3733-439e-a783-8c8be9c1ee0e)

https://github.com/vtex-sites/starter.store/pull/737

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2362)
- [Slack
thread](https://vtex.slack.com/archives/C069YM7R73P/p1741962308203469?thread_ts=1741782251.679469&cid=C069YM7R73P)
- [Session Manager API - Edit
session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)
hellofanny pushed a commit that referenced this pull request Jul 2, 2025
The PR #2749 introduced a bug:
when the store doesn't have the Delivery Promise feature enabled, the
channel `regionId` wasn't being updated.

The Checkout updates the session's `regionId` when we update the session
to add info about `geoCoordinates`, `country`, and `postalCode`. But we
were only doing that when the Delivery Promise feature was enabled.
This conditional was removed.

For the `sellers` info that we get from Checkout request, we only need
to make this request if there is a `seller` info inside the `channel`.
So a conditional was introduced to reduce the need of making this
request every time.

Check it with Delivery Promise enabled and disabled. On both flows the
session in the IndexedDB should be updated to add `regionId` inside the
channel when a `postalCode` is added in the RegionBar.

To check the `seller` info: an option is changing the config inside
`discovery.config`:
`channel:
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true",
"seller":"storeframework01"}',`
and also set a `postalCode` there:
`postalCode: '90210',`

The session in the IndexedDB should contain the valid seller (example:
`storeframework01`) inside the channel if it was added (in config, for
example).

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants