@vtex/faststore-plugin-buyer-portal 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -9,9 +9,9 @@ import { Icon } from "../../components/Icon";
|
|
|
9
9
|
export type AddressDetailsLayoutProps = { data: AddressData };
|
|
10
10
|
|
|
11
11
|
export const AddressDetailsLayout = ({
|
|
12
|
-
data: { id,
|
|
12
|
+
data: { id, isActive, ...addressData },
|
|
13
13
|
}: AddressDetailsLayoutProps) => {
|
|
14
|
-
const [checked, setChecked] = useState(
|
|
14
|
+
const [checked, setChecked] = useState(isActive);
|
|
15
15
|
|
|
16
16
|
const props = Object.keys(addressLabelToPropMapping) as Array<
|
|
17
17
|
keyof typeof addressLabelToPropMapping
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AddressData, AddressSummaryData } from "../types/AddressData";
|
|
2
2
|
import { statusFilters } from "../utils/search";
|
|
3
|
-
import { API_URL } from '../utils/constants';
|
|
4
|
-
import storeConfig from '../../../../discovery.config'
|
|
5
3
|
import { getApiUrl } from "../utils/api";
|
|
6
4
|
|
|
7
5
|
export type GetAddressesServiceProps = {
|
package/src/utils/api.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { API_URL } from "./constants"
|
|
2
|
-
import storeConfig from '../../../../discovery.config'
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
export function getApiUrl(operation: string, customerId: string) {
|
|
6
|
-
return `${API_URL(
|
|
5
|
+
return `${API_URL(`https://b2bfaststore.myvtex.com/` ?? '', operation)}${customerId ? `/${customerId}` : ''}`
|
|
7
6
|
}
|
package/src/utils/cookie.ts
CHANGED
|
@@ -17,13 +17,17 @@ export function getAuthCookie(data: LoaderData) {
|
|
|
17
17
|
export function getCustomerIdFromCookieServerSide(data: LoaderData) {
|
|
18
18
|
const authCookie = getAuthCookie(data)
|
|
19
19
|
|
|
20
|
+
if (!authCookie || authCookie === '') {
|
|
21
|
+
return 'TempCustomerId'
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
const parsedCookie = parseJwt(authCookie)
|
|
21
25
|
|
|
22
26
|
return parsedCookie.customerId
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export function getCookieAsString(cookie: Record<string, string>) {
|
|
26
|
-
return JSON.stringify(cookie).replace(/[{}]/g, '')
|
|
30
|
+
return JSON.stringify(cookie).replace(/[{}]/g, '') ?? ''
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
function parseJwt(token: string) {
|