Skip to content

Commit

Permalink
Merge branch 'master' into fix/login-error
Browse files Browse the repository at this point in the history
  • Loading branch information
enzomerca authored Oct 15, 2024
2 parents a2fbbae + c23f936 commit 53eacc5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Force setProfile to use a valid cost center
- Increase timeout to 45 seconds

## [1.44.12] - 2024-10-14

### Added

- getRegionId now includes geographic coordinates in parameters when available

## [1.44.11] - 2024-10-10

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "storefront-permissions",
"vendor": "vtex",
"version": "1.44.11",
"version": "1.44.12",
"title": "Storefront Permissions",
"description": "Manage User's permissions on apps that relates to this app",
"mustUpdateAt": "2022-08-28",
Expand Down
25 changes: 20 additions & 5 deletions node/clients/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,27 @@ export class Checkout extends JanusClient {

public getRegionId = (
country: string,
postalCode: string,
salesChannel: string
postalCode: string | null,
salesChannel: string,
geoCoordinates: [number, number] | null
): Promise<RegionsResponse[]> => {
return this.get(
`/api/checkout/pub/regions?country=${country}&postalCode=${postalCode}&sc=${salesChannel}`
)
const baseUrl = '/api/checkout/pub/regions'
const params = new URLSearchParams({
country,
sc: salesChannel,
})

if (postalCode) {
params.append('postalCode', postalCode)
}

if (geoCoordinates) {
params.append('geoCoordinates', geoCoordinates.join(';'))
}

const url = `${baseUrl}?${params.toString()}`

return this.get(url)
}

protected get = <T>(url: string, config: RequestConfig = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vtex.checkout-ui-custom",
"version": "1.44.11",
"version": "1.44.12",
"dependencies": {
"@vtex/api": "6.47.0",
"atob": "^2.1.2",
Expand Down
3 changes: 2 additions & 1 deletion node/resolvers/Routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ export const Routes = {
const [regionId] = await checkout.getRegionId(
address.country,
address.postalCode,
salesChannel.toString()
salesChannel.toString(),
address.geoCoordinates
)

if (regionId?.id) {
Expand Down
2 changes: 1 addition & 1 deletion node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=

stats-lite@vtex/node-stats-lite#dist:
"stats-lite@github:vtex/node-stats-lite#dist":
version "2.2.0"
resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797"
dependencies:
Expand Down

0 comments on commit 53eacc5

Please sign in to comment.