@pagamio/frontend-commons-lib 0.8.291 → 0.8.292

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/lib/api/client.js CHANGED
@@ -159,7 +159,11 @@ export class ApiClient {
159
159
  * Creates a URL with query parameters.
160
160
  */
161
161
  createUrl(endpoint, params) {
162
- const url = new URL(endpoint.startsWith('http') ? endpoint : `${this.config.baseURL}${endpoint}`);
162
+ const raw = endpoint.startsWith('http') ? endpoint : `${this.config.baseURL}${endpoint}`;
163
+ // When baseURL is a relative path (e.g. /api/v1) we need window.location.origin
164
+ // as the base for the URL constructor.
165
+ const base = typeof window !== 'undefined' ? window.location.origin : undefined;
166
+ const url = new URL(raw, base);
163
167
  if (params) {
164
168
  Object.entries(params).forEach(([key, value]) => {
165
169
  url.searchParams.append(key, value);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagamio/frontend-commons-lib",
3
3
  "description": "Pagamio library for Frontend reusable components like the form engine and table container",
4
- "version": "0.8.291",
4
+ "version": "0.8.292",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false