Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@grconrad/vscode-extension-feedback

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grconrad/vscode-extension-feedback - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

lib/commands.d.ts

13

lib/checker.d.ts

@@ -1,1 +0,12 @@

export {};
/**
* The brain of the feedback checking mechanism
*/
import { IFeedbackContext, IFeedbackOpts } from "./types";
/**
* Check whether anything needs to be done for feedback gathering. If it's appropriate to ask for
* feedback, do that now. Then schedule the next feedback check, if appropriate.
*
* If the user closes the prompt or clicks "Not now", schedule the next check and stash the timeout
* id.
*/
export declare function checkForFeedback(feedbackContext: IFeedbackContext, opts: IFeedbackOpts): Promise<void>;

16

lib/checker.js
"use strict";
// The brain of the feedback check mechanism
/**
* The brain of the feedback checking mechanism
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -12,7 +14,4 @@ const types_1 = require("./types");

*
* If user does not repond (or says "not now"), schedule next check and hang onto the timeout id.
*
* @param feedbackContext
* @param opts Timing options
* @internal
* If the user closes the prompt or clicks "Not now", schedule the next check and stash the timeout
* id.
*/

@@ -53,7 +52,4 @@ async function checkForFeedback(feedbackContext, opts) {

*
* @param feedbackContext
* @param opts Timing options
* @returns Result of the check, typically a reason why we didn't ask for feedback or the result
* from asking
* @internal
*/

@@ -100,3 +96,3 @@ async function checkNow(feedbackContext, opts) {

// Ask now.
let result = await prompt_1.askForFeedback(feedbackContext, opts.feedbackFormUrl);
const result = await prompt_1.askForFeedback(feedbackContext, opts);
memento.update(storage_1.KEY_LAST_ASKED, now);

@@ -103,0 +99,0 @@ if (result === types_1.FeedbackCheckResult.RESPONSE_DONT_ASK) {

@@ -1,6 +0,18 @@

import { Disposable } from "vscode";
import { IFeedbackContext, IFeedbackOpts } from "./types";
/**
* Initiate feedback checking.
* Entry point
*
* This module imports "vscode" API surface so that other modules don't have to.
*
* This keeps our dependency on "vscode" to the topmost level in the module dependency graph. It
* allows other modules to be unit tested, with test logic supplying mock implementations.
*/
export declare function scheduleFeedbackChecks(feedbackContext: IFeedbackContext, opts: IFeedbackOpts): Promise<Disposable>;
import { Memento } from "vscode";
export { scheduleFeedbackChecks } from "./scheduler";
/**
* Clear persisted state.
*
* This should not be called under most circumstances, but could come in handy in rare situations
* e.g. when an extension's author publishes a major version upgrade and wants to wipe the slate
* clean and prompt again for feedback following installation.
*/
export declare function clearStorage(memento: Memento): void;
"use strict";
/* Scheduling and unscheduling (cancellation) of feedback checks */
Object.defineProperty(exports, "__esModule", { value: true });
const state_1 = require("./state");
const timings_1 = require("./timings");
const l10n_1 = require("./l10n");
const checker_1 = require("./checker");
/**
* Initiate feedback checking.
* Entry point
*
* This module imports "vscode" API surface so that other modules don't have to.
*
* This keeps our dependency on "vscode" to the topmost level in the module dependency graph. It
* allows other modules to be unit tested, with test logic supplying mock implementations.
*/
async function scheduleFeedbackChecks(feedbackContext, opts) {
// Just to be defensive, make sure this hasn't been called before.
const feedbackCheckTimeoutId = state_1.getFeedbackCheckTimeoutId();
if (feedbackCheckTimeoutId !== null) {
throw "scheduleFeedbackChecks called twice";
}
// Apply default timings if applicable.
opts.timings = Object.assign(timings_1.defaultTimings, opts.timings || {});
// Apply default text if applicable.
opts.localizedText = Object.assign(l10n_1.defaultText, opts.localizedText || {});
// Start the checking sequence.
await checker_1.checkForFeedback(feedbackContext, opts);
// Return a disposable.
return {
dispose: () => {
unscheduleFeedbackChecks();
}
};
}
exports.scheduleFeedbackChecks = scheduleFeedbackChecks;
Object.defineProperty(exports, "__esModule", { value: true });
const storage_1 = require("./storage");
var scheduler_1 = require("./scheduler");
exports.scheduleFeedbackChecks = scheduler_1.scheduleFeedbackChecks;
/**
* Cancel any pending (scheduled) feedback check.
* Clear persisted state.
*
* This should not be called under most circumstances, but could come in handy in rare situations
* e.g. when an extension's author publishes a major version upgrade and wants to wipe the slate
* clean and prompt again for feedback following installation.
*/
function unscheduleFeedbackChecks() {
let feedbackCheckTimeoutId = state_1.getFeedbackCheckTimeoutId();
if (feedbackCheckTimeoutId !== null) {
clearTimeout(feedbackCheckTimeoutId);
state_1.setFeedbackCheckTimeoutId(null);
}
function clearStorage(memento) {
storage_1.ALL_KEYS.forEach(key => {
memento.update(key, undefined);
});
}
exports.clearStorage = clearStorage;
//# sourceMappingURL=index.js.map

@@ -1,1 +0,8 @@

export {};
/**
* Ask the user for feedback
*/
import { FeedbackCheckResult, IFeedbackContext, IFeedbackOpts } from "./types";
/**
* Prompt user for feedback using an info message.
*/
export declare function askForFeedback(feedbackContext: IFeedbackContext, opts: IFeedbackOpts): Promise<FeedbackCheckResult>;
"use strict";
/**
* Ask the user for feedback
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,24 +9,17 @@ const vscode_1 = require("vscode");

const commands_1 = require("./commands");
const DONT_ASK_AGAIN = "Don't ask again";
const NOT_NOW = "Not now";
const OPEN_SURVEY = "Give feedback";
const buttons = [
OPEN_SURVEY,
NOT_NOW,
DONT_ASK_AGAIN,
];
/**
* @internal
* Prompt user for feedback using an info message.
*/
async function askForFeedback(feedbackContext, feedbackFormUrl) {
const buttonClicked = await vscode_1.window.showInformationMessage("Enjoying this extension? We'd love your feedback!", ...buttons);
if (buttonClicked === DONT_ASK_AGAIN) {
async function askForFeedback(feedbackContext, opts) {
const { promptText, giveFeedbackText, notNowText, dontAskAgainText } = opts.localizedText;
const buttonClicked = await vscode_1.window.showInformationMessage(promptText, giveFeedbackText, notNowText, dontAskAgainText);
if (buttonClicked === dontAskAgainText) {
return types_1.FeedbackCheckResult.RESPONSE_DONT_ASK;
}
else if (buttonClicked === OPEN_SURVEY) {
const openedSurvey = await commands_1.openExternalFeedbackForm(feedbackFormUrl);
else if (buttonClicked === giveFeedbackText) {
const openedSurvey = await commands_1.openExternalFeedbackForm(opts.feedbackFormUrl);
// If there was some problem opening the survey, log it.
// And treat this as if the user hadn't responded, since we never got feedback.
if (!openedSurvey) {
feedbackContext.logFn(`Error: could not open survey at ${feedbackFormUrl}`);
feedbackContext.logFn(`Error: could not open survey at ${opts.feedbackFormUrl}`);
return types_1.FeedbackCheckResult.NO_RESPONSE;

@@ -30,0 +26,0 @@ }

@@ -0,3 +1,6 @@

/**
* State held in memory
*/
/// <reference types="node" />
export declare function getFeedbackCheckTimeoutId(): NodeJS.Timeout | null;
export declare function setFeedbackCheckTimeoutId(timeoutId: NodeJS.Timeout | null): void;
"use strict";
/**
* State held in memory
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +6,0 @@ let feedbackCheckTimeoutId = null;

@@ -0,1 +1,4 @@

/**
* State persisted to disk
*/
export declare const KEY_LAST_FEEDBACK = "feedback.lastResponseTime";

@@ -2,0 +5,0 @@ export declare const KEY_DONT_ASK = "feedback.dontAskAgain";

"use strict";
/**
* State persisted to disk
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +6,0 @@ // Keys in persisted state where we remember timing information across VS Code invocations

@@ -0,2 +1,5 @@

/**
* Timings of feedback checks / prompts
*/
import { ITimings } from "./types";
export declare const defaultTimings: ITimings;
"use strict";
/**
* Timings of feedback checks / prompts
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +6,0 @@ // Once per day, see if we need to do anything

{
"name": "@grconrad/vscode-extension-feedback",
"version": "0.0.2",
"version": "0.0.3",
"description": "Timing based feedback gathering for VS Code extensions",

@@ -28,7 +28,12 @@ "keywords": [

"clean": "rimraf lib",
"coverage": "jest --coverage",
"dev:all": "yarn && yarn clean && yarn lint && yarn build && yarn test",
"lint": "eslint -c .eslintrc 'src/**/*.ts' --ext js,ts",
"test": "tape test/*.js"
"test": "jest"
},
"jest": {
"preset": "ts-jest"
},
"devDependencies": {
"@types/jest": "^25.1.4",
"@types/node": "^13.9.5",

@@ -40,4 +45,6 @@ "@types/vscode": "^1.43.0",

"eslint": "^6.5.1",
"jest": "^25.2.4",
"rimraf": "^3.0.0",
"tape": "^4.11.0",
"ts-jest": "^25.3.0",
"ts-node": "^8.8.1",
"typescript": "^3.8.3"

@@ -44,0 +51,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc