+
Skip to content

Extend preview to 30 days #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Buy license key](https://img.shields.io/badge/%24-paid-orange)](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme)
[![15 day free preview](https://img.shields.io/badge/trial-15%20day-orange)](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme)
[![30 day free preview](https://img.shields.io/badge/trial-30%20day-orange)](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme)
[![Platform: macOS](https://img.shields.io/badge/platform-macOS-yellow)](https://en.wikipedia.org/wiki/MacOS)
[![Requires CircleCI®](https://img.shields.io/badge/requires-CirlcleCI%C2%AE-yellow)](https://circleci.com/docs/2.0/first-steps/)

Expand Down Expand Up @@ -53,7 +53,7 @@ Find out in seconds whether the setup is right, all in your local.

Local CI requires a [license key](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme) for $15 per month.

But first you'll get a free 15-day preview, no credit card needed.
But first you'll get a free 30-day preview, no credit card needed.

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
{
"url": "https://img.shields.io/badge/trial-15%20day-orange",
"href": "https://getlocalci.com/pricing/?utm_medium=extension&utm_source=badge",
"description": "15 day free preview"
"description": "30 day free preview"
},
{
"url": "https://img.shields.io/badge/platform-macOS-yellow",
Expand Down
9 changes: 0 additions & 9 deletions src/classes/IconCommand.ts

This file was deleted.

31 changes: 7 additions & 24 deletions src/classes/JobProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@ import getDockerError from '../utils/getDockerError';
import prepareConfig from '../utils/prepareConfig';
import {
CREATE_CONFIG_FILE_COMMAND,
DAY_IN_MILLISECONDS,
ENTER_LICENSE_COMMAND,
EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS,
GET_LICENSE_COMMAND,
JOB_TREE_VIEW_ID,
PROCESS_TRY_AGAIN_COMMAND,
TAKE_SURVEY_COMMAND,
TRIAL_STARTED_TIMESTAMP,
HAS_EXTENDED_TRIAL,
} from '../constants';
import IconCommand from './IconCommand';

enum JobError {
DockerNotRunning,
Expand All @@ -46,10 +41,10 @@ export default class JobProvider
readonly onDidChangeTreeData: vscode.Event<Job | undefined> =
this._onDidChangeTreeData.event;
private jobs: string[] = [];
private jobErrorType?: JobError;
private jobErrorMessage?: string;
private runningJob?: string;
private jobErrorType?: JobError;
private logs: Record<string, string[]> = {};
private runningJob?: string;

constructor(
private readonly context: vscode.ExtensionContext,
Expand Down Expand Up @@ -226,11 +221,6 @@ export default class JobProvider

getErrorTreeItems(): Array<vscode.TreeItem | Command | Warning> {
const errorMessage = this.getJobErrorMessage();
const licenseKeyTreeItems = [
new Warning('Please enter a Local CI license key.'),
new Command('Get License', GET_LICENSE_COMMAND),
new Command('Enter License', ENTER_LICENSE_COMMAND),
];

switch (this.jobErrorType) {
case JobError.DockerNotRunning:
Expand All @@ -240,18 +230,11 @@ export default class JobProvider
new Command('Try Again', `${JOB_TREE_VIEW_ID}.refresh`),
];
case JobError.LicenseKey:
return !this.context.globalState.get(HAS_EXTENDED_TRIAL)
? [
...licenseKeyTreeItems,
new IconCommand(
`Get ${
EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS / DAY_IN_MILLISECONDS
} more free days by taking a 2-minute survey`,
TAKE_SURVEY_COMMAND,
'rocket'
),
]
: licenseKeyTreeItems;
return [
new Warning('Please enter a Local CI license key.'),
new Command('Get License', GET_LICENSE_COMMAND),
new Command('Enter License', ENTER_LICENSE_COMMAND),
];
case JobError.NoConfigFilePathInWorkspace:
return [
new Warning('Error: No .circleci/config.yml found'),
Expand Down
8 changes: 0 additions & 8 deletions src/classes/LicenseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { LICENSE_ERROR } from '../constants';
import getLicenseErrorMessage from '../utils/getLicenseErrorMessage';
import getLicenseInformation from '../utils/getLicenseInformation';
import isLicenseValid from '../utils/isLicenseValid';
import onClickTakeSurvey from '../utils/onClickTakeSurvey';
import showLicenseInput from '../utils/showLicenseInput';

function getNonce() {
Expand Down Expand Up @@ -67,13 +66,6 @@ export default class LicenseProvider implements vscode.WebviewViewProvider {
});
}
}

if (data.type === 'takeSurvey') {
onClickTakeSurvey(this.context, () => {
this.load();
this.licenseSuccessCallback();
});
}
});
}

Expand Down
4 changes: 1 addition & 3 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export const SELECTED_CONFIG_PATH = 'local-ci.config.path';
export const LICENSE_ERROR = 'localCiLicenseKeyError';
export const GET_LICENSE_COMMAND = 'local-ci.license.get';
export const ENTER_LICENSE_COMMAND = 'local-ci.license.enter';
export const SURVEY_URL = 'https://www.surveymonkey.com/r/localci';
export const TAKE_SURVEY_COMMAND = 'local-ci.survey.take';
export const EXIT_JOB_COMMAND = 'local-ci.job.exit';
export const PROCESS_TRY_AGAIN_COMMAND = 'local-ci.process-error.try-again';

Expand Down Expand Up @@ -45,7 +43,7 @@ export const LICENSE_VALIDITY = 'local-ci.license.validity';
export const LICENSE_VALIDITY_CACHE_EXPIRATION =
'local-ci.license.cache.expiration';
export const DAY_IN_MILLISECONDS = 86400000;
export const TRIAL_LENGTH_IN_MILLISECONDS = 15 * DAY_IN_MILLISECONDS;
export const TRIAL_LENGTH_IN_MILLISECONDS = 30 * DAY_IN_MILLISECONDS;
export const EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS = 15 * DAY_IN_MILLISECONDS;
export const HAS_EXTENDED_TRIAL = 'local-ci.license.trial-extended.survey';
export const TRIAL_STARTED_TIMESTAMP =
Expand Down
8 changes: 0 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
RUN_JOB_COMMAND,
SELECTED_CONFIG_PATH,
SHOW_LOG_FILE_COMMAND,
TAKE_SURVEY_COMMAND,
TELEMETRY_KEY,
TRIAL_STARTED_TIMESTAMP,
} from './constants';
Expand All @@ -39,7 +38,6 @@ import getDynamicConfigPath from './utils/getDynamicConfigPath';
import getFinalTerminalName from './utils/getFinalTerminalName';
import getRepoBasename from './utils/getRepoBasename';
import getStarterConfig from './utils/getStarterConfig';
import onClickTakeSurvey from './utils/onClickTakeSurvey';
import prepareConfig from './utils/prepareConfig';
import runJob from './utils/runJob';
import showLicenseInput from './utils/showLicenseInput';
Expand Down Expand Up @@ -88,12 +86,6 @@ export function activate(context: vscode.ExtensionContext): void {

context.subscriptions.push(
reporter,
vscode.commands.registerCommand(TAKE_SURVEY_COMMAND, () => {
onClickTakeSurvey(context, () => {
licenseProvider.load();
jobProvider.hardRefresh();
});
}),
vscode.commands.registerCommand(`${JOB_TREE_VIEW_ID}.refresh`, () =>
jobProvider.hardRefresh()
),
Expand Down
6 changes: 3 additions & 3 deletions src/test/suite/utils/getMillisecondsRemainingInTrial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ suite('getMillisecondsRemainingInTrial', () => {
time - 24 * hourInMilliseconds,
TRIAL_LENGTH_IN_MILLISECONDS
),
14 * DAY_IN_MILLISECONDS
29 * DAY_IN_MILLISECONDS
);
});

Expand All @@ -33,7 +33,7 @@ suite('getMillisecondsRemainingInTrial', () => {
assert.strictEqual(
getMillisecondsRemainingInTrial(
time,
time - (14 * DAY_IN_MILLISECONDS + 23 * hourInMilliseconds),
time - (29 * DAY_IN_MILLISECONDS + 23 * hourInMilliseconds),
TRIAL_LENGTH_IN_MILLISECONDS
),
hourInMilliseconds
Expand All @@ -45,7 +45,7 @@ suite('getMillisecondsRemainingInTrial', () => {
assert.strictEqual(
getMillisecondsRemainingInTrial(
time,
time - 15 * DAY_IN_MILLISECONDS,
time - 30 * DAY_IN_MILLISECONDS,
TRIAL_LENGTH_IN_MILLISECONDS
),
0
Expand Down
16 changes: 8 additions & 8 deletions src/test/suite/utils/isTrialExpired.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ suite('isTrialExpired', () => {
test('preview barely expired', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - (15 * DAY_IN_MILLISECONDS + 1),
new Date().getTime() - (30 * DAY_IN_MILLISECONDS + 1),
TRIAL_LENGTH_IN_MILLISECONDS
),
true
Expand All @@ -36,7 +36,7 @@ suite('isTrialExpired', () => {
test('trial expired by 2 days', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - 17 * DAY_IN_MILLISECONDS,
new Date().getTime() - 32 * DAY_IN_MILLISECONDS,
TRIAL_LENGTH_IN_MILLISECONDS
),
true
Expand All @@ -50,30 +50,30 @@ suite('isTrialExpired', () => {
);
});

test('preview began 15 days and 10 milliseconds ago and was extended', () => {
test('preview began 30 days and 10 milliseconds ago and was extended', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - (15 * DAY_IN_MILLISECONDS + 10),
new Date().getTime() - (30 * DAY_IN_MILLISECONDS + 10),
extendedTrial
),
false
);
});

test('preview began 17 days ago and was extended', () => {
test('preview began 32 days ago and was extended', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - 17 * DAY_IN_MILLISECONDS,
new Date().getTime() - 32 * DAY_IN_MILLISECONDS,
extendedTrial
),
false
);
});

test('preview began 30 days and 1 millisecond ago and was extended', () => {
test('preview began 45 days and 1 millisecond ago and was extended', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - 30 * DAY_IN_MILLISECONDS,
new Date().getTime() - 45 * DAY_IN_MILLISECONDS,
extendedTrial
),
true
Expand Down
57 changes: 0 additions & 57 deletions src/test/suite/utils/onClickTakeSurvey.test.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/utils/getLicenseInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import isLicenseValid from './isLicenseValid';
import isTrialExpired from './isTrialExpired';
import {
DAY_IN_MILLISECONDS,
EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS,
GET_LICENSE_KEY_URL,
HAS_EXTENDED_TRIAL,
LICENSE_ERROR,
LICENSE_KEY,
LICENSE_VALIDITY,
Expand All @@ -28,15 +26,11 @@ export default async function getLicenseInformation(
const enterLicenseButton = `<button class="secondary" id="enter-license">Enter license key</button>`;
const changeLicenseButton = `<button class="secondary" id="enter-license">Change license key</button>`;
const retryValidationButton = `<button class="secondary" id="retry-license-validation">Retry license validation</button>`;
const takeSurveyButton = `<button class="button primary" id="take-survey">Get ${
EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS / DAY_IN_MILLISECONDS
} more free days by taking a 2-minute anonymous survey</button>`;
const scheduleInterviewLink = `<a class="button primary" href="${SCHEDULE_INTERVIEW_URL}" target="_blank">Get a free lifetime license by doing a 30-minute Zoom user research interview</a>`;
const complainUri = 'mailto:ryan@getlocalci.com';
const complainLink = `<a class="button secondary" href="${complainUri}" target="_blank">Complain to me</a>`;

const isValid = await isLicenseValid(context);
const hasExtendedTrial = context.globalState.get(HAS_EXTENDED_TRIAL);
const trialLengthInMilliseconds = getTrialLength(context);
const isPreviewExpired = isTrialExpired(
previewStartedTimeStamp,
Expand All @@ -59,7 +53,6 @@ export default async function getLicenseInformation(
<p>${getLicenseErrorMessage(await context.secrets.get(LICENSE_ERROR))}</p>
<p>${getLicenseLink}</p>
<p>${enterLicenseButton}</p>
${hasExtendedTrial ? '' : `<p>${takeSurveyButton}</p>`}
<p>${retryValidationButton}</p>
<p>${complainLink}</p>`;
}
Expand All @@ -73,7 +66,6 @@ export default async function getLicenseInformation(
if (isPreviewExpired) {
return `<p>Thanks for previewing Local CI! The free preview is over.</p>
<p>Please enter a Local CI license key to keep using this.</p>
${hasExtendedTrial ? '' : `<p>${takeSurveyButton}</p>`}
<p>${getLicenseLink}</p>
<p>${enterLicenseButton}</p>
<p>${complainLink}</p>`;
Expand All @@ -87,6 +79,5 @@ export default async function getLicenseInformation(
)} left in this free preview.</p>
<p>${getLicenseLink}</p>
<p>${enterLicenseButton}</p>
${hasExtendedTrial ? '' : `<p>${takeSurveyButton}</p>`}
<p>${complainLink}</p>`;
}
32 changes: 0 additions & 32 deletions src/utils/onClickTakeSurvey.ts

This file was deleted.

Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载