Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/remove-launchdarkly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tokens-studio/figma-plugin": patch
---

Remove LaunchDarkly feature flag system. All previously feature-flagged functionality (idStorage, multi-file sync for pro users) is now always available. Multi-file sync remains gated behind pro user license check.
3 changes: 1 addition & 2 deletions packages/tokens-studio-for-figma/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
MIXPANEL_ACCESS_TOKEN=
STORYBLOK_ACCESS_TOKEN=
ENVIRONMENT=development
LICENSE_API_URL=https://licence.tokens.studio
LAUNCHDARKLY_SDK_CLIENT=626fb05d52e5c715abd11b5e
LICENSE_API_URL=https://licence.tokens.studio
3 changes: 1 addition & 2 deletions packages/tokens-studio-for-figma/.env.production.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
MIXPANEL_ACCESS_TOKEN=
STORYBLOK_ACCESS_TOKEN=
ENVIRONMENT=production
LICENSE_API_URL=https://licence.tokens.studio
LAUNCHDARKLY_SDK_CLIENT=626fb05d52e5c715abd11b5e
LICENSE_API_URL=https://licence.tokens.studio
8 changes: 0 additions & 8 deletions packages/tokens-studio-for-figma/cypress/support/mockEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ const MockEnv = () => {
success: true
}).as('storyblok')

cy.intercept('GET', `https://app.launchdarkly.com/**`, {
success: true
}).as('app-launchdarkly')

cy.intercept('POST', `https://events.launchdarkly.com/**`, {
success: true
}).as('events-launchdarkly')

cy.intercept('GET', `**/get-license*`, {
plan: 'pro'
}).as('getLicense')
Expand Down
13 changes: 0 additions & 13 deletions packages/tokens-studio-for-figma/flags.d.ts

This file was deleted.

6 changes: 2 additions & 4 deletions packages/tokens-studio-for-figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "cross-env NODE_ENV=production webpack --mode=production",
"build:dev": "cross-env NODE_ENV=development webpack --mode=development",
"build:preview": "cross-env NODE_ENV=development webpack --mode=development --PREVIEW_ENV=browser",
"build:cy": "cross-env LAUNCHDARKLY_FLAGS=tokenThemes,gitBranchSelector,multiFileSync,tokenFlowButton yarn build",
"build:cy": "yarn build",
"start": "cross-env webpack --mode=development --watch",
"preview:ws": "node preview-server.js",
"preview:plugin": "webpack --mode=development --PREVIEW_ENV=figma",
Expand All @@ -21,7 +21,7 @@
"benchmark:run": "node benchmark/index.mjs",
"benchmark:run:update": "node benchmark/index.mjs --update",
"prettier:format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,css,json}' ",
"test": "cross-env LAUNCHDARKLY_FLAGS=tokenThemes,gitBranchSelector,multiFileSync,tokenFlowButton jest",
"test": "jest",
"test:watch": "npm run test -- --watch --collectCoverage=false",
"test:quiet": "npm run test -- --reporters=jest-silent-reporter --coverage=false",
"test:coverage": "npm run test -- --collectCoverageFrom='[\"src/**/*.{js,jsx,ts,tsx}\"]' --coverage --collectCoverage=true --coverageDirectory='./' --forceExit --detectOpenHandles",
Expand Down Expand Up @@ -103,8 +103,6 @@
"just-safe-get": "^4.0.1",
"just-safe-set": "^4.0.2",
"just-split": "^3.0.1",
"launchdarkly-js-client-sdk": "^2.24.2",
"launchdarkly-react-client-sdk": "^2.28.0",
"lodash.debounce": "^4.0.8",
"lz-string": "^1.5.0",
"mixpanel-figma": "^2.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ import { addLicenseKey } from '@/utils/addLicenseKey';
// Hide log calls unless they are expected. This is mainly related to react-modal
jest.spyOn(console, 'error').mockImplementation(() => { });

jest.mock('launchdarkly-react-client-sdk', () => ({
LDProvider: (props: React.PropsWithChildren<unknown>) => props.children,
useLDClient: () => ({
identify: () => Promise.resolve(),
}),
useFlags: () => ({}),
}));

function setup(jsx: JSX.Element) {
return {
user: userEvent.setup(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
useCallback, useEffect, useState,
} from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useLDClient } from 'launchdarkly-react-client-sdk';
import { useTranslation } from 'react-i18next';
import {
Button, Heading, TextInput, Box, Stack, IconButton,
Expand All @@ -18,19 +17,17 @@
import ProBadge from '../ProBadge';
import { userIdSelector } from '@/selectors/userIdSelector';
import { licenseDetailsSelector } from '@/selectors';
import { ldUserFactory } from '@/utils/ldUserFactory';
import { ErrorMessage } from '../ErrorMessage';
import { addLicenseKey } from '@/utils/addLicenseKey';

export default function AddLicenseKey() {
const dispatch = useDispatch<Dispatch>();
const existingKey = useSelector(licenseKeySelector);
const licenseDetails = useSelector(licenseDetailsSelector);

Check failure on line 26 in packages/tokens-studio-for-figma/src/app/components/AddLicenseKey/AddLicenseKey.tsx

View workflow job for this annotation

GitHub Actions / ESLint

'licenseDetails' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 26 in packages/tokens-studio-for-figma/src/app/components/AddLicenseKey/AddLicenseKey.tsx

View workflow job for this annotation

GitHub Actions / copilot

'licenseDetails' is assigned a value but never used. Allowed unused vars must match /^_/u
const licenseKeyError = useSelector(licenseKeyErrorSelector);
const [newKey, setLicenseKey] = useState(existingKey);
const { confirm } = useConfirm();
const userId = useSelector(userIdSelector);
const ldClient = useLDClient();
const { t } = useTranslation(['licence']);
const [isMasked, setIsMasked] = useState(true);

Expand All @@ -50,14 +47,6 @@
}
}, [newKey, dispatch, userId]);

const removeAccessToFeatures = useCallback(() => {
if (userId) {
ldClient?.identify({
key: userId,
});
}
}, [userId, ldClient]);

const removeKey = useCallback(async () => {
if (licenseKeyError) {
dispatch.userState.removeLicenseKey(undefined);
Expand All @@ -69,10 +58,9 @@
});
if (confirmation) {
dispatch.userState.removeLicenseKey(undefined);
removeAccessToFeatures();
}
}
}, [t, dispatch, confirm, removeAccessToFeatures, licenseKeyError]);
}, [t, dispatch, confirm, licenseKeyError]);

const ManageSubscriptionLink = styled('a', {
color: '$accentDefault',
Expand All @@ -83,14 +71,6 @@
setLicenseKey(existingKey);
}, [existingKey]);

useEffect(() => {
if (userId && existingKey && licenseDetails) {
ldClient?.identify(
ldUserFactory(userId, licenseDetails.plan, licenseDetails.entitlements, licenseDetails.clientEmail),
);
}
}, [userId, ldClient, existingKey, licenseDetails]);

const onLicenseKeyChange = useCallback((ev: React.ChangeEvent<HTMLInputElement>) => {
setLicenseKey(ev.target.value.trim());
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { AsyncMessageChannel } from '@/AsyncMessageChannel';
import { useStartupProcess } from './useStartupProcess';
import { ProcessStepStatus } from '@/hooks';
import { withLDProviderWrapper } from '../LaunchDarkly';
import { ApplicationInitSteps } from './ApplicationInitSteps';
import ConfirmDialog from '../ConfirmDialog';
import WindowResizer from '../WindowResizer';
Expand All @@ -35,12 +34,11 @@
const applicationInitStepLabels = {
[ApplicationInitSteps.SAVE_PLUGIN_DATA]: 'Receiving local data',
[ApplicationInitSteps.ADD_LICENSE]: 'Verifying license',
[ApplicationInitSteps.GET_LD_FLAGS]: 'Initializing LaunchDarkly',
[ApplicationInitSteps.SAVE_STORAGE_INFORMATION]: 'Checking storage type',
[ApplicationInitSteps.PULL_TOKENS]: 'Fetching (remote) tokens',
};

export const AppContainer = withLDProviderWrapper((params: Props) => {
export const AppContainer = (params: Props) => {
const { isDarkTheme } = useFigmaTheme();
const dispatch = useDispatch<Dispatch>();
const startupProcess = useStartupProcess(params);
Expand Down Expand Up @@ -111,5 +109,5 @@
</Box>
);

return <AuthContextProvider authData={params.authData}>{appContent}</AuthContextProvider>;

Check failure on line 112 in packages/tokens-studio-for-figma/src/app/components/AppContainer/AppContainer.tsx

View workflow job for this annotation

GitHub Actions / ESLint

Must use destructuring params assignment

Check failure on line 112 in packages/tokens-studio-for-figma/src/app/components/AppContainer/AppContainer.tsx

View workflow job for this annotation

GitHub Actions / copilot

Must use destructuring params assignment
});
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export enum ApplicationInitSteps {
SAVE_PLUGIN_DATA = 'save-plugin-data',
ADD_LICENSE = 'add-license',
GET_LD_FLAGS = 'get-ld-flags',
SAVE_STORAGE_INFORMATION = 'save-storage-information',
PULL_TOKENS = 'pull-tokens',
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,6 @@ const withOrWithoutLicense = (
};
// #endregion

jest.mock('launchdarkly-react-client-sdk', () => ({
LDProvider: (props: React.PropsWithChildren<unknown>) => props.children,
useLDClient: () => ({
identify: () => Promise.resolve(),
}),
useFlags: () => ({}),
}));

describe('AppContainer (integration)', () => {
beforeEach(resetSuite);

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './savePluginDataFactory';
export * from './addLicenseFactory';
export * from './getLdFlagsFactory';
export * from './saveStorageInformationFactory';
export * from './pullTokensFactory';
Loading
Loading