demoMode.tsx 642 B

12345678910111213141516171819202122
  1. export function extraQueryParameter(): URLSearchParams {
  2. const extraQueryString = window.SandboxData?.extraQueryString || '';
  3. const extraQuery = new URLSearchParams(extraQueryString);
  4. return extraQuery;
  5. }
  6. export function extraQueryParameterWithEmail(): URLSearchParams {
  7. const params = extraQueryParameter();
  8. const email = localStorage.getItem('email');
  9. if (email) {
  10. params.append('email', email);
  11. }
  12. return params;
  13. }
  14. export function urlAttachQueryParams(url: string, params: URLSearchParams): string {
  15. const queryString = params.toString();
  16. if (queryString) {
  17. return url + '?' + queryString;
  18. }
  19. return url;
  20. }