mitra-interactions-sdk 1.0.53 → 1.0.55

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