Skip to content

feat: [Delivery Promise] Default postal code - #2708

Merged
lariciamota merged 5 commits into
feat/delivery-promisefrom
feat/delivery-promise-postal-code-default
Mar 10, 2025
Merged

lariciamota merged 5 commits into
feat/delivery-promisefrom
feat/delivery-promise-postal-code-default

Conversation

@lariciamota

@lariciamota lariciamota commented Feb 28, 2025 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

Add in discovery.config.js the config that will be used for the new feature Delivery Promise and update code related to validate session to change the postalCode to the default one if it's null or empty.

How it works?

If the session's postalCode is null or empty, it changes to the initial/default one configured in discovery.config.js in the session object.

How to test it?

In the starter preview's discovery.config.js file, I've added 90210 as the default postal code and enabled the deliveryPromise feature. Then if you test the preview you should see this postal code in the IndexedDB of the browser's devtools.
Screenshot 2025-02-28 at 14 00 42

You can also test that it'll be updated to the default postal code if the postal code in the IDB is null or empty previously for some reason (like if you had already accessed the store before this change). It can be done by editing the IDB through a script in the browser's devtools. Here is the snippet I've used:
Screenshot 2025-02-28 at 14 17 40

var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
Screen.Recording.2025-02-28.at.14.23.39.mov

Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/ (PR)

References

Checklist

  • For documentation changes, ping @Mariana-Caetano to review and update (Or submit a doc request)

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

codesandbox-ci Bot commented Feb 28, 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.

},

deliveryPromise: {
enabled: false,

@lariciamota lariciamota Mar 5, 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.

There will be more config added in the next tasks, this is the reason for adding an object deliveryPromise and not a single boolean enableDeliveryPromise: false.

@lariciamota
lariciamota marked this pull request as ready for review March 5, 2025 15:25
@lariciamota
lariciamota requested a review from a team as a code owner March 5, 2025 15:25
@lariciamota
lariciamota requested review from emersonlaurentino and pedromtec and removed request for a team March 5, 2025 15:25

@eduardoformiga eduardoformiga 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.

Good job, @lariciamota .

I left some questions along with the review, but it is related to the feature behavior itself, not to the code. I'll let it pre-approved.

Comment thread packages/core/src/sdk/session/index.ts Resolved
Comment thread packages/core/src/sdk/session/index.ts Resolved
Comment thread packages/core/src/sdk/session/index.ts Resolved
@lariciamota
lariciamota force-pushed the feat/delivery-promise-postal-code-default branch from 78d621a to 6aabafd Compare March 10, 2025 15:19
@lariciamota
lariciamota merged commit a8588e2 into feat/delivery-promise Mar 10, 2025
@lariciamota
lariciamota deleted the feat/delivery-promise-postal-code-default branch March 10, 2025 15:36
hellofanny pushed a commit that referenced this pull request Mar 26, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request Mar 27, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request Mar 28, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request Apr 8, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request Apr 11, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request Apr 22, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request May 8, 2025
## What's the purpose of this pull request?

Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

## How it works?

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

## How to test it?

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04


### Starters Deploy Preview

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

## References

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

## Checklist

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
lariciamota added a commit that referenced this pull request May 12, 2025
Add in `discovery.config.js` the config that will be used for the new
feature Delivery Promise and update code related to validate session to
change the `postalCode` to the default one if it's null or empty.

If the session's `postalCode` is null or empty, it changes to the
initial/default one configured in `discovery.config.js` in the `session`
object.

In the starter preview's `discovery.config.js` file, I've added `90210`
as the default postal code and enabled the deliveryPromise feature. Then
if you test the preview you should see this postal code in the IndexedDB
of the browser's devtools.
![Screenshot 2025-02-28 at 14 00
42](https://github.com/user-attachments/assets/26db75a2-339d-4eef-bf83-0c3cb6fab915)

You can also test that it'll be updated to the default postal code if
the postal code in the IDB is null or empty previously for some reason
(like if you had already accessed the store before this change). It can
be done by [editing the IDB through a script in the browser's
devtools](https://developer.chrome.com/docs/devtools/storage/indexeddb).
Here is the snippet I've used:
![Screenshot 2025-02-28 at 14 17
40](https://github.com/user-attachments/assets/b15de9e7-0b77-44c9-b999-cdaad5062663)
```
var connection = indexedDB.open('keyval-store', 1);

connection.onsuccess = (e) => {
    var database = e.target.result;
    var objectStore = database.transaction(['keyval'],'readwrite').objectStore('keyval');
    var getRequest = objectStore.get('fs::session');
    getRequest.onsuccess = (e) => {
        var data = e.target.result;
        data.postalCode = null;
        var updateRequest = objectStore.put(data, 'fs::session');
        updateRequest.onsuccess = (event) => {
            console.log(event.target.result);
        }
    }
}
```

https://github.com/user-attachments/assets/104164bf-80e8-4bec-bcd5-982f4fe60e04

https://storeframework-cm652ufll028lmgv665a6xv0g-8kzj40dcm.b.vtex.app/
([PR](https://github.com/vtex-sites/starter.store/pull/705))

- [Jira task 1](https://vtex-dev.atlassian.net/browse/SFS-2199)
- [Jira task 2](https://vtex-dev.atlassian.net/browse/SFS-2200)
- [Delivery Promise RFC - related section
1](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.igtfl04jtxbb)
- [Delivery Promise RFC - related section
2](https://docs.google.com/document/d/15IUc7_sQ_MxM67TJJI4fqbnTyc9PVdy_jJb5M0iMhyE/edit?tab=t.0#heading=h.h45g42imthwf)

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)
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]>
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.

3 participants