mitra-interactions-sdk 1.0.53 → 1.0.54

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/dist/index.js CHANGED
@@ -60,7 +60,8 @@ function autoConfigureFromLogin(response, authUrl, projectId) {
60
60
  }
61
61
  function buildAuthUrl(authUrl, method, projectId, opts) {
62
62
  const base = authUrl.endsWith("/") ? authUrl : authUrl + "/";
63
- let url = `${base}?method=${method}&projectId=${encodeURIComponent(projectId)}`;
63
+ const separator = base.includes("?") ? "&" : "?";
64
+ let url = `${base}${separator}method=${method}&projectId=${encodeURIComponent(projectId)}`;
64
65
  if (opts == null ? void 0 : opts.returnTo) url += `&returnTo=${encodeURIComponent(opts.returnTo)}`;
65
66
  if (opts == null ? void 0 : opts.create) url += `&create=true`;
66
67
  if (opts == null ? void 0 : opts.title) url += `&title=${encodeURIComponent(opts.title)}`;
@@ -169,7 +170,8 @@ function openSilentAuthIframe(authUrl, projectId, credentials) {
169
170
  return new Promise((resolve, reject) => {
170
171
  const origin = getOriginFromUrl(authUrl);
171
172
  const base = authUrl.endsWith("/") ? authUrl : authUrl + "/";
172
- let url = `${base}?mode=silent&projectId=${encodeURIComponent(projectId)}`;
173
+ const separator = base.includes("?") ? "&" : "?";
174
+ let url = `${base}${separator}mode=silent&projectId=${encodeURIComponent(projectId)}`;
173
175
  if (typeof window !== "undefined") {
174
176
  url += `&originUrl=${encodeURIComponent(window.location.href)}`;
175
177
  }