@vtex/faststore-plugin-buyer-portal 1.0.22 → 1.0.24
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
|
@@ -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 '
|
|
3
|
-
|
|
2
|
+
import storeConfig from 'discovery.config'
|
|
4
3
|
|
|
5
4
|
export function getApiUrl(operation: string, customerId: string) {
|
|
6
|
-
return `${API_URL(storeConfig?.secureSubdomain ?? '', operation)}${customerId ? `/${customerId}` : ''}`
|
|
5
|
+
return `${API_URL(`${storeConfig?.secureSubdomain}` ?? '', operation)}${customerId ? `/${customerId}` : ''}`
|
|
7
6
|
}
|
package/src/utils/cookie.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AUT_COOKIE_KEY } from "./constants"
|
|
2
|
-
import storeConfig from '
|
|
2
|
+
import storeConfig from 'discovery.config'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
type LoaderData = {
|
|
@@ -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 ''
|
|
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) {
|