@nhost/nhost-js 4.2.1-beta0 → 4.2.1-rc1

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.
@@ -427,9 +427,17 @@ const createAPIClient = (baseURL, chainFunctions = []) => {
427
427
  };
428
428
  };
429
429
  const signInProviderURL = (provider, params) => {
430
- const encodedParameters = params && Object.entries(params).map(([key, value]) => {
431
- const stringValue = Array.isArray(value) ? value.join(",") : typeof value === "object" ? JSON.stringify(value) : value;
432
- return `${key}=${encodeURIComponent(stringValue)}`;
430
+ const encodedParameters = params && Object.entries(params).flatMap(([key, value]) => {
431
+ if (key === "providerSpecificParams") {
432
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
433
+ return Object.entries(value).map(
434
+ ([k, v]) => `${k}=${encodeURIComponent(String(v))}`
435
+ );
436
+ }
437
+ return [`${key}=${encodeURIComponent(String(value))}`];
438
+ }
439
+ const stringValue = Array.isArray(value) ? value.join(",") : typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
440
+ return [`${key}=${encodeURIComponent(stringValue)}`];
433
441
  }).join("&");
434
442
  const url = encodedParameters ? `${baseURL}/signin/provider/${provider}?${encodedParameters}` : `${baseURL}/signin/provider/${provider}`;
435
443
  return url;
@@ -885,9 +893,9 @@ const createAPIClient = (baseURL, chainFunctions = []) => {
885
893
  };
886
894
  };
887
895
  const verifyTicketURL = (params) => {
888
- const encodedParameters = params && Object.entries(params).map(([key, value]) => {
889
- const stringValue = Array.isArray(value) ? value.join(",") : typeof value === "object" ? JSON.stringify(value) : value;
890
- return `${key}=${encodeURIComponent(stringValue)}`;
896
+ const encodedParameters = params && Object.entries(params).flatMap(([key, value]) => {
897
+ const stringValue = Array.isArray(value) ? value.join(",") : typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
898
+ return [`${key}=${encodeURIComponent(stringValue)}`];
891
899
  }).join("&");
892
900
  const url = encodedParameters ? `${baseURL}/verify?${encodedParameters}` : `${baseURL}/verify`;
893
901
  return url;