demoMode.tsx 923 B

1234567891011121314151617181920212223242526272829303132
  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 extraQueryParameterWithEmailV2(): URLSearchParams {
  15. const params = extraQueryParameter();
  16. const email = localStorage.getItem('email');
  17. if (email) {
  18. params.append('email', email);
  19. }
  20. params.append('referrer', 'sandbox-walkthrough');
  21. return params;
  22. }
  23. export function urlAttachQueryParams(url: string, params: URLSearchParams): string {
  24. const queryString = params.toString();
  25. if (queryString) {
  26. return url + '?' + queryString;
  27. }
  28. return url;
  29. }