Remove referral UI and related logic

This commit is contained in:
jelveh
2026-04-17 12:25:29 -07:00
parent 4adf7b41b9
commit f6c1991068
6 changed files with 3 additions and 247 deletions
+2 -26
View File
@@ -18,7 +18,7 @@
*/
import path from '../lib/path.js';
import UIWindowClaimReferral from './UIWindowClaimReferral.js';
import UIContextMenu from './UIContextMenu.js';
import UIItem from './UIItem.js';
import UIAlert from './UIAlert.js';
@@ -29,7 +29,7 @@ import UIWindowMyWebsites from './UIWindowMyWebsites.js';
import UIWindowFeedback from './UIWindowFeedback.js';
import UIWindowLogin from './UIWindowLogin.js';
import UIWindowQR from './UIWindowQR.js';
import UIWindowRefer from './UIWindowRefer.js';
import UIWindowProgress from './UIWindowProgress.js';
import UITaskbar from './UITaskbar.js';
import new_context_menu_item from '../helpers/new_context_menu_item.js';
@@ -1244,11 +1244,6 @@ async function UIDesktop (options) {
// 'Show Desktop'
ht += `<a href="/" class="show-desktop-btn toolbar-btn antialiased hidden" target="_blank" title="${i18n('desktop_show_desktop')}">${i18n('desktop_show_desktop')} <img src="${window.icons['launch-white.svg']}" style="width: 10px; height: 10px; margin-left: 5px;"></a>`;
// refer
if ( window.user.referral_code ) {
ht += `<div class="toolbar-btn refer-btn" title="${i18n('toolbar.refer')}" style="background-image:url(${window.icons['gift.svg']});"></div>`;
}
// github
ht += `<a href="https://github.com/HeyPuter/puter" target="_blank" class="toolbar-btn" title="${i18n('toolbar.github')}" style="background-image:url(${window.icons['logo-github-white.svg']});"></a>`;
@@ -1458,21 +1453,6 @@ async function UIDesktop (options) {
display_ct();
setInterval(display_ct, 1000);
// show referral notice window
if ( window.show_referral_notice && !window.user.email_confirmed ) {
puter.kv.get('shown_referral_notice').then(async (val) => {
if ( !val || val === 'false' || val === false ) {
setTimeout(() => {
UIWindowClaimReferral();
}, 1000);
puter.kv.set({
key: 'shown_referral_notice',
value: true,
});
}
});
}
window.hide_toolbar = (animate = true) => {
// Always show toolbar on mobile and tablet devices
if ( isMobile.phone || isMobile.tablet ) {
@@ -2388,10 +2368,6 @@ $(document).on('click', '.user-options-create-account-btn', async function (e) {
});
});
$(document).on('click', '.refer-btn', async function (e) {
UIWindowRefer();
});
$(document).on('click', '.start-app', async function (e) {
launch_app({
name: $(this).attr('data-app-name'),
-71
View File
@@ -1,71 +0,0 @@
/**
* Copyright (C) 2024-present Puter Technologies Inc.
*
* This file is part of Puter.
*
* Puter is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import UIWindow from './UIWindow.js';
import UIWindowSaveAccount from './UIWindowSaveAccount.js';
async function UIWindowClaimReferral (options) {
let h = '';
h += '<div>';
h += '<div class="qr-code-window-close-btn generic-close-window-button disable-user-select"> &times; </div>';
h += `<img src="${window.icons['present.svg']}" style="width: 70px; margin: 20px auto 20px; display: block; margin-bottom: 20px;">`;
h += `<h1 style="font-weight: 400; padding: 0 10px; font-size: 21px; text-align: center; margin-bottom: 0; color: #60626d; -webkit-font-smoothing: antialiased;">${i18n('you_have_been_referred_to_puter_by_a_friend')}</h1>`;
h += `<p style="text-align: center; font-size: 16px; padding: 20px; font-weight: 400; margin: -10px 10px 0px 10px; -webkit-font-smoothing: antialiased; color: #5f626d;">${i18n('confirm_account_for_free_referral_storage_c2a')}</p>`;
h += `<button class="button button-primary button-block create-account-ref-btn" style="display: block;">${i18n('create_account')}</button>`;
h += '</div>';
const el_window = await UIWindow({
title: 'Refer a friend!',
icon: null,
uid: null,
is_dir: false,
body_content: h,
has_head: false,
selectable_body: false,
draggable_body: true,
allow_context_menu: false,
is_draggable: true,
is_resizable: false,
is_droppable: false,
init_center: true,
allow_native_ctxmenu: true,
allow_user_select: true,
width: 400,
dominant: true,
window_css: {
height: 'initial',
},
body_css: {
width: 'initial',
'max-height': 'calc(100vh - 200px)',
'background-color': 'rgb(241 246 251)',
'backdrop-filter': 'blur(3px)',
'padding': '10px 20px 20px 20px',
'height': 'initial',
},
});
$(el_window).find('.create-account-ref-btn').on('click', function (e) {
UIWindowSaveAccount();
$(el_window).close();
});
}
export default UIWindowClaimReferral;
-118
View File
@@ -1,118 +0,0 @@
/**
* Copyright (C) 2024-present Puter Technologies Inc.
*
* This file is part of Puter.
*
* Puter is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import UIWindow from './UIWindow.js';
import UIPopover from './UIPopover.js';
import socialLink from '../helpers/socialLink.js';
async function UIWindowRefer (options) {
let h = '';
const url = `${window.gui_origin}/?r=${window.user.referral_code}`;
h += '<div>';
h += '<div class="qr-code-window-close-btn generic-close-window-button disable-user-select"> &times; </div>';
h += `<img src="${window.icons['present.svg']}" style="width: 70px; margin: 20px auto 20px; display: block; margin-bottom: 20px;">`;
h += `<p class="refer-friend-c2a">${i18n('refer_friends_c2a')}</p>`;
h += `<label style="font-weight: bold;">${i18n('invite_link')}</label>`;
h += '<input type="text" style="margin-bottom:10px;" class="downloadable-link" readonly />';
h += `<button class="button button-primary copy-downloadable-link" style="white-space:nowrap; text-align:center;">${i18n('copy_link')}</button>`;
h += `<img class="share-copy-link-on-social" src="${window.icons['share-outline.svg']}">`;
h += '</div>';
const el_window = await UIWindow({
title: i18n('window_title_refer_friend'),
window_class: 'window-refer-friend',
icon: null,
uid: null,
is_dir: false,
body_content: h,
has_head: false,
selectable_body: false,
draggable_body: true,
allow_context_menu: false,
is_draggable: true,
is_resizable: false,
is_droppable: false,
init_center: true,
allow_native_ctxmenu: true,
allow_user_select: true,
width: 500,
dominant: true,
window_css: {
height: 'initial',
},
body_css: {
width: 'initial',
'max-height': 'calc(100vh - 200px)',
'background-color': 'rgb(241 246 251)',
'backdrop-filter': 'blur(3px)',
'padding': '10px 20px 20px 20px',
'height': 'initial',
},
});
$(el_window).find('.window-body .downloadable-link').val(url);
$(el_window).find('.window-body .share-copy-link-on-social').on('click', function (e) {
const social_links = socialLink({ url: url, title: i18n('refer_friends_social_media_c2a'), description: i18n('refer_friends_social_media_c2a') });
let social_links_html = '';
social_links_html += '<div style="padding: 10px;">';
social_links_html += `<p style="margin: 0; text-align: center; margin-bottom: 6px; color: #484a57; font-weight: bold; font-size: 14px;">${i18n('share_to')}</p>`;
social_links_html += `<a class="copy-link-social-btn" target="_blank" href="${social_links.twitter}" style=""><svg viewBox="0 0 24 24" aria-hidden="true" style="opacity: 0.7;"><g><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></g></svg></a>`;
social_links_html += `<a class="copy-link-social-btn" target="_blank" href="${social_links.whatsapp}" style=""><img src="${window.icons['logo-whatsapp.svg']}"></a>`;
social_links_html += `<a class="copy-link-social-btn" target="_blank" href="${social_links.facebook}" style=""><img src="${window.icons['logo-facebook.svg']}"></a>`;
social_links_html += `<a class="copy-link-social-btn" target="_blank" href="${social_links.linkedin}" style=""><img src="${window.icons['logo-linkedin.svg']}"></a>`;
social_links_html += `<a class="copy-link-social-btn" target="_blank" href="${social_links.reddit}" style=""><img src="${window.icons['logo-reddit.svg']}"></a>`;
social_links_html += `<a class="copy-link-social-btn" target="_blank" href="${social_links['telegram.me']}" style=""><img src="${window.icons['logo-telegram.svg']}"></a>`;
social_links_html += '</div>';
UIPopover({
content: social_links_html,
snapToElement: this,
parent_element: this,
// width: 300,
height: 100,
position: 'bottom',
});
});
$(el_window).find('.window-body .copy-downloadable-link').on('click', async function (e) {
var copy_btn = this;
if ( navigator.clipboard ) {
// Get link text
const selected_text = $(el_window).find('.window-body .downloadable-link').val();
// copy selected text to clipboard
await navigator.clipboard.writeText(selected_text);
}
else {
// Get the text field
$(el_window).find('.window-body .downloadable-link').select();
// Copy the text inside the text field
document.execCommand('copy');
}
$(this).html(i18n('link_copied'));
setTimeout(function () {
$(copy_btn).html(i18n('copy_link'));
}, 1000);
});
}
export default UIWindowRefer;
-1
View File
@@ -318,7 +318,6 @@ function UIWindowSignup (options) {
// Include captcha in request only if required
const requestData = {
username: username,
referral_code: window.referral_code,
email: email,
password: password,
referrer: options.referrer ?? window.referrerStr,
+1 -16
View File
@@ -5417,13 +5417,6 @@ html.dark-mode .usage-table-show-less:hover {
max-width: calc(100% - 30px);
}
.device-phone .window.window-refer-friend {
left: 50% !important;
transform: translate(-50%) !important;
height: initial !important;
max-width: calc(100% - 30px);
}
.device-phone .window.window-task-manager {
height: initial !important;
}
@@ -5682,15 +5675,7 @@ html.dark-mode .usage-table-show-less:hover {
visibility: hidden;
}
.refer-friend-c2a {
text-align: center;
font-size: 16px;
padding: 20px;
font-weight: 400;
margin: -10px 10px 20px 10px;
-webkit-font-smoothing: antialiased;
color: #5f626d;
}
.progress-report{
font-size:15px;
overflow: hidden;
-15
View File
@@ -516,20 +516,6 @@ window.initgui = async function (options) {
window.history.replaceState(null, document.title, cleanUrl);
}
//--------------------------------------------------------------------------------------
// Get user referral code from URL query params
// i.e. https://puter.com/?r=123456
//--------------------------------------------------------------------------------------
if ( window.url_query_params.has('r') ) {
window.referral_code = window.url_query_params.get('r');
// remove 'r' from URL
window.history.pushState(null, document.title, '/');
// show referral notice, this will be used later if Desktop is loaded
if ( window.first_visit_ever ) {
window.show_referral_notice = true;
}
}
//--------------------------------------------------------------------------------------
// Desktop background (early)
// Set before action=login/signup so OIDC error redirects show the background behind the form.
@@ -1161,7 +1147,6 @@ window.initgui = async function (options) {
let spinner_init_ts = Date.now();
const requestData = {
referrer: referrer,
referral_code: window.referral_code,
is_temp: true,
};