Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: deprecate affiliate frontend (#274)

gbirmanc14efbe89608
diff --git a/js/app/packages/analytics/src/types/TrackingEvents.ts b/js/app/packages/analytics/src/types/TrackingEvents.ts
index 962b63c4cc..2a5486bfe8 100644
--- a/js/app/packages/analytics/src/types/TrackingEvents.ts
+++ b/js/app/packages/analytics/src/types/TrackingEvents.ts
@@ -26,9 +26,6 @@ export const TrackingEvents = {
UPGRADE: 'WEBAPP_Start-Upgrade',
REFERRAL: 'WEBAPP_Start-Referral',
},
- AFFILIATE: {
- ASSIGN: 'WEBAPP_Affiliate-Assign',
- },
ONBOARDING: {
START: 'WEBAPP_Onboarding-Start',
COMPLETE: 'WEBAPP_Onboarding-Complete',
diff --git a/js/app/packages/app/component/auth/Login.tsx b/js/app/packages/app/component/auth/Login.tsx
index 75e4a4a803..fb932260b2 100644
--- a/js/app/packages/app/component/auth/Login.tsx
+++ b/js/app/packages/app/component/auth/Login.tsx
@@ -22,7 +22,7 @@ import {
import { updateCookie } from '../../util/updateCookie';
import { EmailForm } from './EmailForm';
import { LoginOptions } from './LoginOptions';
-import { checkAffiliate, Input, identifyUser, Stage } from './Shared';
+import { Input, identifyUser, Stage } from './Shared';
import ThreeWireframe from './ThreeWireframe';
import { VerifyForm } from './VerifyForm';
@@ -36,7 +36,6 @@ export function Login() {
createEffect(() => {
if (authenticated()) {
identifyUser();
- checkAffiliate();
}
});
diff --git a/js/app/packages/app/component/auth/Shared.tsx b/js/app/packages/app/component/auth/Shared.tsx
index f572963d97..a9ac67a9be 100644
--- a/js/app/packages/app/component/auth/Shared.tsx
+++ b/js/app/packages/app/component/auth/Shared.tsx
@@ -40,14 +40,6 @@ export const identifyUser = async () => {
}
};
-export const checkAffiliate = () => {
- const url = new URL(window.location.href);
- const affiliateCode = url.searchParams.get('referral');
- if (affiliateCode) {
- sessionStorage.setItem('affiliateCode', affiliateCode);
- }
-};
-
export const assignABGroup = async () => {
const randomGroup = Math.random() < 0.5 ? 'A' : 'B';
gqlServiceClient.setGroup({ group: randomGroup });
diff --git a/js/app/packages/app/component/auth/VerifyForm.tsx b/js/app/packages/app/component/auth/VerifyForm.tsx
index 3dfaa5a257..533d7da5e7 100644
--- a/js/app/packages/app/component/auth/VerifyForm.tsx
+++ b/js/app/packages/app/component/auth/VerifyForm.tsx
@@ -11,7 +11,7 @@ import {
Show,
} from 'solid-js';
import { sendEmailCode, useResetEmailCode } from './EmailForm';
-import { checkAffiliate, ErrorMsg, Input, identifyUser, Stage } from './Shared';
+import { ErrorMsg, Input, identifyUser, Stage } from './Shared';
const verifyCode = action(async (formData: FormData) => {
const code = formData.get('one-time-code');
@@ -33,7 +33,6 @@ const verifyCode = action(async (formData: FormData) => {
}
await identifyUser();
- checkAffiliate();
const url = new URL(window.location.href);
const searchParams = new URLSearchParams(url.search);
diff --git a/js/app/packages/service-storage/client.ts b/js/app/packages/service-storage/client.ts
index 9bb226d012..e8ce9629b2 100644
--- a/js/app/packages/service-storage/client.ts
+++ b/js/app/packages/service-storage/client.ts
@@ -31,7 +31,6 @@ import type { SafeFetchInit } from '@core/util/safeFetch';
import { utf8Encode } from '@core/util/string';
import type { IDocumentStorageServiceFile } from '@filesystem/file';
import { platformFetch } from 'core/util/platformFetch';
-import { createResource } from 'solid-js';
import type { AccessLevel, View, ViewsResponse } from './generated/schemas';
import type { AddPinRequest } from './generated/schemas/addPinRequest';
import type { AnchorResponse } from './generated/schemas/anchorResponse';
@@ -243,36 +242,6 @@ export const storageServiceClient = {
);
},
- affiliates: {
- async getAffiliateList() {
- const response = await dssFetch<{
- users: {
- email: string;
- createdAt: number;
- }[];
- }>(`/affiliate`);
- return response;
- },
- async assignAffiliate(params: { email: string }) {
- return mapOk(
- await dssFetch<SuccessResponse>(`/affiliate/${params.email}`, {
- method: 'POST',
- }),
- (result) => result.data
- );
- },
- async getReferredBy() {
- return mapOk(
- await dssFetch<{
- affiliate?: {
- email: string;
- };
- }>(`/affiliate/referred_by`),
- (result) => result
- );
- },
- },
-
permissionsTokens: {
async createPermissionToken(args) {
return await dssFetch<GetDocumentPermissionsTokenResponse>(
@@ -1334,22 +1303,4 @@ export const uploadFileToPresignedUrl = async (
}
};
-export const [affiliateList, { refetch: refetchAffiliateList }] =
- createResource(async () => {
- const response = await storageServiceClient.affiliates.getAffiliateList();
- if (!isOk(response)) return;
- const [, responseData] = response;
- return responseData.users;
- });
-
-export const [referredBy, { refetch: refetchReferredBy }] = createResource(
- async () => {
- const response = await storageServiceClient.affiliates.getReferredBy();
- if (!isOk(response)) return;
- const [, responseData] = response;
-
- return responseData.affiliate?.email;
- }
-);
-
registerClient('storage', storageServiceClient);
diff --git a/js/app/packages/service-storage/service.ts b/js/app/packages/service-storage/service.ts
index c865406dd2..e40e6cae88 100644
--- a/js/app/packages/service-storage/service.ts
+++ b/js/app/packages/service-storage/service.ts
@@ -207,7 +207,7 @@ export const ViewsSvc = new Svc('Views Service')
throws: withFetchErrors(),
})
.fn('createSavedView', {
- description: 'Assign an affiliate to a user',
+ description: 'Create a saved view',
args: schemas.createViewHandlerBody.shape,
modifies: true,
result: schemas.createViewHandlerResponse.shape,
@@ -237,34 +237,6 @@ export const ViewsSvc = new Svc('Views Service')
throws: withFetchErrors(),
});
-export const AffiliatesSvc = new Svc('Affiliates Service')
- .use('fetchErrors', fetchErrorsSvc)
- .fn('getAffiliateList', {
- description: 'Get the list of affiliates',
- result: {
- users: z.array(
- z.object({
- email: z.string(),
- createdAt: z.number(),
- })
- ),
- },
- throws: withFetchErrors(),
- })
- .fn('assignAffiliate', {
- description: 'Assign an affiliate to a user',
- args: {
- email: z.string(),
- },
- modifies: true,
- result: {},
- throws: withFetchErrors(),
- })
- .fn('getReferredBy', {
- description: 'Get the user who referred a user',
- result: {},
- });
-
export const PermissionsTokensSvc = new Svc('Permissions Tokens Service')
.use('fetchErrors', fetchErrorsSvc)
.fn('createPermissionToken', {
@@ -750,7 +722,6 @@ export const StorageService = new Svc('Document++ Storage Service API')
})
.use('annotations', AnnotationsSvc)
.use('projects', ProjectsSvc)
- .use('affiliates', AffiliatesSvc)
.use('permissionsTokens', PermissionsTokensSvc)
.use('instructions', InstructionsSvc)
.use('views', ViewsSvc);