Skip to content

Commit

Permalink
Merge pull request #1390 from internxt/release/2.8.1
Browse files Browse the repository at this point in the history
[_]: release/2.8.1
  • Loading branch information
sg-gs authored Dec 17, 2024
2 parents a4d4636 + 07bec4d commit 5dfc0bb
Show file tree
Hide file tree
Showing 38 changed files with 979 additions and 416 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@internxt/internxtui": "^0.0.6",
"@internxt/inxt-js": "=1.2.21",
"@internxt/lib": "^1.2.0",
"@internxt/sdk": "=1.5.24",
"@internxt/sdk": "=1.8.0",
"@phosphor-icons/react": "^2.1.7",
"@popperjs/core": "^2.11.6",
"@reduxjs/toolkit": "^1.6.0",
Expand Down Expand Up @@ -71,13 +71,13 @@
"react-router-dom": "^5.3.4",
"react-scripts": "5.0.1",
"react-tooltip": "^5.8.3",
"socket.io-client": "4.4.1",
"socket.io-client": "4.8.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"streamsaver": "^2.0.5",
"url": "^0.11.3",
"util": "^0.12.5",
"uuid": "^8.3.2",
"uuid": "=8.3.2",
"web-vitals": "^0.2.4",
"xlsx-preview": "^1.0.4"
},
Expand Down Expand Up @@ -120,7 +120,6 @@
]
},
"devDependencies": {
"asmcrypto.js": "git+https://github.com/asmcrypto/asmcrypto.js.git",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@craco/craco": "^7.1.0",
"@internxt/eslint-config-internxt": "^1.0.3",
Expand All @@ -144,6 +143,7 @@
"@types/wicg-file-system-access": "^2020.9.4",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-istanbul": "^2.1.6",
"asmcrypto.js": "git+https://github.com/asmcrypto/asmcrypto.js.git",
"autoprefixer": "^10.4.16",
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
Expand Down
11 changes: 3 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import { Redirect, Route, Router, Switch } from 'react-router-dom';

import { Portal } from '@headlessui/react';
import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings';
import { ActionDialog } from 'app/contexts/dialog-manager/ActionDialogManager.context';
import { useActionDialog } from 'app/contexts/dialog-manager/useActionDialog';
import { AppView } from 'app/core/types';
import { FolderPath } from 'app/drive/types';
import { ModifyStorageModal } from 'app/newSettings/Sections/Workspace/Members/components/ModifyStorageModal';
import { useAppSelector } from 'app/store/hooks';
import workspacesSelectors from 'app/store/slices/workspaces/workspaces.selectors';
import i18next, { t } from 'i18next';
Expand Down Expand Up @@ -38,20 +41,15 @@ import { sessionActions } from './app/store/slices/session';
import { uiActions } from './app/store/slices/ui';
import { initializeUserThunk } from './app/store/slices/user';
import { workspaceThunks } from './app/store/slices/workspaces/workspacesStore';
import SurveyDialog from './app/survey/components/SurveyDialog/SurveyDialog';
import { manager } from './app/utils/dnd-utils';
import useBeforeUnload from './hooks/useBeforeUnload';
import { ModifyStorageModal } from 'app/newSettings/Sections/Workspace/Members/components/ModifyStorageModal';
import { ActionDialog } from 'app/contexts/dialog-manager/ActionDialogManager.context';
import { useActionDialog } from 'app/contexts/dialog-manager/useActionDialog';
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

interface AppProps {
isAuthenticated: boolean;
isInitialized: boolean;
isFileViewerOpen: boolean;
isNewsletterDialogOpen: boolean;
isSurveyDialogOpen: boolean;
isPreferencesDialogOpen: boolean;
fileViewerItem: PreviewFileItem | null;
user: UserSettings | undefined;
Expand All @@ -65,7 +63,6 @@ const App = (props: AppProps): JSX.Element => {
isAuthenticated,
isFileViewerOpen,
isNewsletterDialogOpen,
isSurveyDialogOpen,
isPreferencesDialogOpen,
fileViewerItem,
dispatch,
Expand Down Expand Up @@ -220,7 +217,6 @@ const App = (props: AppProps): JSX.Element => {
{isOpen && <ModifyStorageModal />}

<NewsletterDialog isOpen={isNewsletterDialogOpen} />
{isSurveyDialogOpen && <SurveyDialog isOpen={isSurveyDialogOpen} />}
{isFileViewerOpen && fileViewerItem && (
<FileViewerWrapper file={fileViewerItem} onClose={onCloseFileViewer} showPreview={isFileViewerOpen} />
)}
Expand All @@ -237,7 +233,6 @@ export default connect((state: RootState) => ({
isInitialized: state.user.isInitialized,
isFileViewerOpen: state.ui.isFileViewerOpen,
isNewsletterDialogOpen: state.ui.isNewsletterDialogOpen,
isSurveyDialogOpen: state.ui.isSurveyDialogOpen,
isPreferencesDialogOpen: state.ui.isPreferencesDialogOpen,
fileViewerItem: state.ui.fileViewerItem,
user: state.user.user,
Expand Down
85 changes: 15 additions & 70 deletions src/app/analytics/impact.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import axios from 'axios';
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidV4 } from 'uuid';
import dayjs from 'dayjs';
import { getCookie } from './utils';
import errorService from 'app/core/services/error.service';
import httpService from 'app/core/services/http.service';
import localStorageService from 'app/core/services/local-storage.service';
import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings';
import { AnalyticsTrackNames } from './types';

const IMPACT_API = process.env.REACT_APP_IMPACT_API as string;

Expand All @@ -23,7 +21,7 @@ export async function trackSignUp(uuid, email) {
await axios.post(IMPACT_API, {
anonymousId: anonymousID,
timestamp: dayjs().format('YYYY-MM-DDTHH:mm:ss.sssZ'),
messageId: uuidv4(),
messageId: uuidV4(),
userId: uuid,
type: 'track',
event: 'User Signup',
Expand All @@ -37,74 +35,24 @@ export async function trackSignUp(uuid, email) {

export async function trackPaymentConversion() {
try {
const checkoutSessionId = localStorage.getItem('sessionId');
const { uuid } = localStorageService.getUser() as UserSettings;

const { username, uuid } = localStorageService.getUser() as UserSettings;
let metadata, amount_total, currency, customer, subscription, paymentIntent;
try {
const {
metadata: metadataRetrived,
amount_total: totalAmountRetrieved,
currency: currencyRetrieved,
customer: customerRetrieved,
subscription: subscriptionId,
payment_intent: paymentIntentRetrieved,
} = (await httpService.get(`${process.env.REACT_APP_API_URL}/stripe/session`, {
params: {
sessionId: checkoutSessionId,
},
headers: httpService.getHeaders(true, false),
})) as any;
metadata = metadataRetrived;
amount_total = totalAmountRetrieved;
currency = currencyRetrieved;
customer = customerRetrieved;
paymentIntent = paymentIntentRetrieved;
subscription = subscriptionId;
} catch (error) {
//
}

subscription = subscription ?? localStorageService.get('subscriptionId');
paymentIntent = paymentIntent ?? localStorageService.get('paymentIntentId');
// TO MANTAIN OLD BEHAVIOR
const amount = amount_total ? amount_total * 0.01 : parseFloat(localStorageService.get('amountPaid') ?? '0');
amount_total = amount_total ?? parseFloat(localStorageService.get('amountPaid') ?? '0');
const subscription = localStorageService.get('subscriptionId');
const paymentIntent = localStorageService.get('paymentIntentId');
const productName = localStorageService.get('productName');
const priceId = localStorageService.get('priceId');
const currency = localStorageService.get('currency');
const amount = parseFloat(localStorageService.get('amountPaid') ?? '0');

try {
window.rudderanalytics.identify(uuid, {
email: username,
plan: metadata.priceId,
customer_id: customer,
storage_limit: metadata.maxSpaceBytes,
plan_name: metadata.name,
subscription_id: subscription,
payment_intent: paymentIntent,
});
window.rudderanalytics.track(AnalyticsTrackNames.PaymentConversionEvent, {
price_id: metadata.priceId,
product: metadata.product,
email: username,
customer_id: customer,
currency: currency.toUpperCase(),
value: amount,
revenue: amount,
quantity: 1,
type: metadata.type,
plan_name: metadata.name,
impact_value: amount_total === 0 ? 0.01 : amount,
subscription_id: subscription,
payment_intent: paymentIntent,
});

window.gtag('event', 'purchase', {
transaction_id: uuidv4(),
transaction_id: uuidV4(),
value: amount,
currency: currency.toUpperCase(),
currency: currency?.toUpperCase() ?? '€',
items: [
{
item_id: metadata.priceId,
item_name: metadata.name,
item_id: priceId,
item_name: productName,
quantity: 1,
price: amount,
},
Expand All @@ -120,7 +68,7 @@ export async function trackPaymentConversion() {
anonymousId: anonymousID,
timestamp: dayjs().format('YYYY-MM-DDTHH:mm:ss.sssZ'),
properties: {
impact_value: amount_total === 0 ? 0.01 : amount,
impact_value: amount === 0 ? 0.01 : amount,
subscription_id: subscription,
payment_intent: paymentIntent,
},
Expand All @@ -134,9 +82,6 @@ export async function trackPaymentConversion() {
});
}
} catch (err) {
const castedError = errorService.castError(err);
window.rudderanalytics.track('Error Signup After Payment Conversion', {
message: castedError.message || '',
});
//
}
}
2 changes: 1 addition & 1 deletion src/app/core/config/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const views: Array<{
componentProps?: Record<string, unknown>;
}> = [
{ id: AppView.Signup, component: SignUpView, componentProps: { isNewUser: true } },
{ id: AppView.AppSumo, component: SignUpView, componentProps: { isNewUser: false } },
{ id: AppView.AppSumo, component: SignInView },
{ id: AppView.BlockedAccount, component: BlockedAccountView },
{ id: AppView.Login, component: SignInView },
{ id: AppView.SignupBlog, component: SignupBlog },
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class RealtimeService {
});
}

getClientId(): string {
getClientId(): string | undefined {
if (!this.socket) {
throw new Error('Realtime service is not connected');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { connect, useSelector } from 'react-redux';
import { ListShareLinksItem, Role } from '@internxt/sdk/dist/drive/share/types';
import navigationService from 'app/core/services/navigation.service';
import { useTranslationContext } from 'app/i18n/provider/TranslationProvider';
import { skinSkeleton } from 'app/shared/Skeleton';
import moveItemsToTrash from '../../../../../use_cases/trash/move-items-to-trash';
import { OrderDirection, OrderSettings } from '../../../../core/types';
import shareService from '../../../../share/services/share.service';
Expand All @@ -19,6 +20,7 @@ import { uiActions } from '../../../../store/slices/ui';
import workspacesSelectors from '../../../../store/slices/workspaces/workspaces.selectors';
import { DriveItemData, DriveItemDetails } from '../../../types';
import EditItemNameDialog from '../../EditItemNameDialog/EditItemNameDialog';
import ShareWithTeamDialog from '../../ShareWithTeamDialog/ShareWithTeamDialog';
import DriveExplorerListItem from '../DriveExplorerItem/DriveExplorerListItem/DriveExplorerListItem';
import {
contextMenuDriveFolderNotSharedLink,
Expand All @@ -32,8 +34,6 @@ import {
contextMenuWorkspaceFile,
contextMenuWorkspaceFolder,
} from './DriveItemContextMenu';
import { skinSkeleton } from 'app/shared/Skeleton';
import ShareWithTeamDialog from '../../ShareWithTeamDialog/ShareWithTeamDialog';

interface DriveExplorerListProps {
folderId: string;
Expand Down Expand Up @@ -526,7 +526,6 @@ export default connect((state: RootState) => ({
roles: state.shared.roles,
disableKeyboardShortcuts:
state.ui.isShareDialogOpen ||
state.ui.isSurveyDialogOpen ||
state.ui.isEditFolderNameDialog ||
state.ui.isFileViewerOpen ||
state.ui.isMoveItemsDialogOpen ||
Expand Down
41 changes: 37 additions & 4 deletions src/app/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@
"linkUpdated": "Link aktualisiert",
"itemsMovedToTrash": "{{item}} in den Papierkorb verschoben",
"storageModified": "Speicher erfolgreich geändert",
"membersUpdatedSuccessfully": "Mitglieder erfolgreich aktualisiert",
"errorModifyingStorage": "Der neue Speicherplatz ist für dieses Mitglied ungültig.",
"generalErrorWhileModifyingStorage": "Beim Ändern des Speicherplatzes ist ein Fehler aufgetreten.",
"restoreItems": "{{itemsToRecover}} verschoben nach {{destination}}",
Expand All @@ -1264,7 +1265,10 @@
"errorWhileLoadingWorkspace": "Fehler beim Laden des Arbeitsbereichs {{error}}",
"errorFetchingWorkspaceCredentials": "Fehler beim Abrufen der Anmeldeinformationen für den Arbeitsbereich {{error}}",
"invalidWorkspaceInvitationError": "Arbeitsbereich voll. Kontaktieren Sie den Eigentümer.",
"errorAcceptingWorkspaceInvitation": "Beim Annehmen der Einladung ist ein Fehler aufgetreten"
"errorAcceptingWorkspaceInvitation": "Beim Annehmen der Einladung ist ein Fehler aufgetreten",
"errorWhileUpdatingWorkspaceMembers": "Beim Aktualisieren der Mitglieder ist ein Fehler aufgetreten",
"errorWhileFetchingCurrentWorkspaceMembers": "Beim Abrufen der Mitglieder des Arbeitsbereichs ist ein Fehler aufgetreten",
"newMembersCannotBeLessThanTheExistentOnesError": "Die ausgewählten Mitglieder dürfen nicht weniger sein als die aktuellen Mitglieder des Arbeitsbereichs"
},
"actions": {
"undo": "Rückgängig machen",
Expand Down Expand Up @@ -1296,6 +1300,7 @@
"moreInfo": "Mehr Info",
"dismiss": "Zurückweisen",
"save": "Sichern",
"saveChanges": "Änderungen speichern",
"back": "Zurück",
"edit": "Bearbeite",
"submit": "Einreichen",
Expand All @@ -1313,7 +1318,10 @@
"report": "Missbrauch melden",
"yes": "Ja",
"no": "Nein",
"more": "Mehr"
"more": "Mehr",
"continue": "Fortsetzen",
"keepCurrent": "Aktuell behalten",
"logOut": "Abmelden"
},
"drive": {
"usage": "Verwendung",
Expand Down Expand Up @@ -1409,8 +1417,7 @@
"subscribe-to-newsletter": "Abonniere unseren Newsletter",
"install-desktop-app": "Installiere die Desktop-App und lade eine Datei hoch",
"invite-friends": "Lade {{completedSteps}}/{{steps}} Freunde ein",
"invite-2-friends": "Lade {{completedSteps}}/{{steps}} Freunde ein",
"complete-survey": "Komplettiere Umfrage"
"invite-2-friends": "Lade {{completedSteps}}/{{steps}} Freunde ein"
},
"rewards": {
"title": "Erhalte {{creditSum}} kostenlos",
Expand Down Expand Up @@ -1646,6 +1653,32 @@
"nextBillingDate": "Nächstes Abrechnungsdatum",
"planLimit": "Abgerechnet für {{planLimit}} plan",
"subscription": "Abonnement",
"membersLabel": "Mitglieder",
"perUser": "pro Benutzer",
"members": {
"title": "Mitglieder",
"editMembers": "Mitglieder bearbeiten",
"numberOfMembers": "Anzahl der Mitglieder",
"expandNumber": "Die Anzahl der Mitglieder erweitern.",
"confirmUpdateModal": {
"title": "Plan ändern",
"confirmToProceed": {
"text1": "Sie sind dabei, Ihren Internxt-Mitgliederplan von ",
"to": "auf ",
"text2": " zu ändern. Bitte bestätigen Sie Ihre Auswahl, um fortzufahren."
},
"current": "Aktuell",
"new": "Neu",
"decreaseStorage": {
"text": "Dadurch wird auch Ihr gesamter Geschäftsspeicher von ",
"to": " auf "
},
"increaseStorage": {
"text": "Dadurch wird auch Ihr gesamter Geschäftsspeicher von ",
"to": " auf "
}
}
},
"lifetimeSubscription": {
"planType": "Lebenslang",
"text": "Keine kommenden Rechnungen"
Expand Down
Loading

0 comments on commit 5dfc0bb

Please sign in to comment.