You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@solucx/indicators

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solucx/indicators - npm Package Compare versions

Comparing version
1.0.4
to
1.1.0
+12
build/CES.d.ts
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class CES extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CES = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class CES extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.neutralMin = 4;
this.neutralMax = 4;
this.positiveMin = 5;
this.positiveMax = 7;
this.type = Type_1.Type.CES;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives + neutrals;
const score = (positives - negatives) / total;
return score * 100;
}
}
exports.CES = CES;
//# sourceMappingURL=CES.js.map
{"version":3,"file":"CES.js","sourceRoot":"","sources":["../src/CES.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,GAAI,SAAQ,qBAAS;IAAlC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAO3B,CAAC;IALU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC/C,MAAM,KAAK,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC;QAC9C,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;CACJ;AAdD,kBAcC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class CES2 extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CES2 = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class CES2 extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.neutralMin = 4;
this.neutralMax = 4;
this.positiveMin = 5;
this.positiveMax = 7;
this.type = Type_1.Type.CES;
}
}
exports.CES2 = CES2;
//# sourceMappingURL=CES2.js.map
{"version":3,"file":"CES2.js","sourceRoot":"","sources":["../src/CES2.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,IAAK,SAAQ,qBAAS;IAAnC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAC3B,CAAC;CAAA;AARD,oBAQC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class CSAT extends Indicator {
negativeMin: number;
negativeMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSAT = void 0;
const Indicator_1 = require("./Indicator");
const samplingError_1 = require("./samplingError");
const Type_1 = require("./Type");
class CSAT extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.positiveMin = 4;
this.positiveMax = 5;
this.type = Type_1.Type.CSAT;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives;
const score = positives / total;
return score * 100;
}
getSamplingError(total, positives, negatives, neutrals, trustLevel = 1.96) {
return samplingError_1.samplingError(positives + negatives, total, trustLevel);
}
}
exports.CSAT = CSAT;
//# sourceMappingURL=CSAT.js.map
{"version":3,"file":"CSAT.js","sourceRoot":"","sources":["../src/CSAT.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mDAAgD;AAChD,iCAA8B;AAC9B,MAAa,IAAK,SAAQ,qBAAS;IAAnC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,IAAI,CAAC;IAU5B,CAAC;IARU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;QACpC,MAAM,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;QAChC,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;IACM,gBAAgB,CAAC,KAAa,EAAE,SAAiB,EAAE,SAAiB,EAAE,QAAgB,EAAE,aAAqB,IAAI;QACpH,OAAO,6BAAa,CAAC,SAAS,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACnE,CAAC;CACJ;AAfD,oBAeC"}
import { CSAT } from "./CSAT";
import { Type } from "./Type";
export declare class CSAT10 extends CSAT {
negativeMin: number;
negativeMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSAT10 = void 0;
const CSAT_1 = require("./CSAT");
const Type_1 = require("./Type");
class CSAT10 extends CSAT_1.CSAT {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = 6;
this.positiveMin = 7;
this.positiveMax = 10;
this.type = Type_1.Type.CSAT10;
}
}
exports.CSAT10 = CSAT10;
//# sourceMappingURL=CSAT10.js.map
{"version":3,"file":"CSAT10.js","sourceRoot":"","sources":["../src/CSAT10.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,iCAA8B;AAC9B,MAAa,MAAO,SAAQ,WAAI;IAAhC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,EAAE,CAAC;QACjB,SAAI,GAAG,WAAI,CAAC,MAAM,CAAC;IAC9B,CAAC;CAAA;AAND,wBAMC"}
import { NPS } from "./NPS";
import { CES } from "./CES";
import { CSAT } from "./CSAT";
import { CSAT10 } from "./CSAT10";
import { NSS } from "./NSS";
import { Indicator } from "./Indicator";
import { Type } from "./Type";
import { Indicators } from "./Indicators";
import { Rating } from "./Rating";
import { CES2 } from "./CES2";
import { LD } from "./LD";
import { NONE } from "./NONE";
export { NPS, CES2, LD, NONE, CES, CSAT, CSAT10, NSS, Indicator, Rating, Type };
export default Indicators;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Type = exports.Rating = exports.Indicator = exports.NSS = exports.CSAT10 = exports.CSAT = exports.CES = exports.NONE = exports.LD = exports.CES2 = exports.NPS = void 0;
const NPS_1 = require("./NPS");
Object.defineProperty(exports, "NPS", { enumerable: true, get: function () { return NPS_1.NPS; } });
const CES_1 = require("./CES");
Object.defineProperty(exports, "CES", { enumerable: true, get: function () { return CES_1.CES; } });
const CSAT_1 = require("./CSAT");
Object.defineProperty(exports, "CSAT", { enumerable: true, get: function () { return CSAT_1.CSAT; } });
const CSAT10_1 = require("./CSAT10");
Object.defineProperty(exports, "CSAT10", { enumerable: true, get: function () { return CSAT10_1.CSAT10; } });
const NSS_1 = require("./NSS");
Object.defineProperty(exports, "NSS", { enumerable: true, get: function () { return NSS_1.NSS; } });
const Indicator_1 = require("./Indicator");
Object.defineProperty(exports, "Indicator", { enumerable: true, get: function () { return Indicator_1.Indicator; } });
const Type_1 = require("./Type");
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return Type_1.Type; } });
const Indicators_1 = require("./Indicators");
const Rating_1 = require("./Rating");
Object.defineProperty(exports, "Rating", { enumerable: true, get: function () { return Rating_1.Rating; } });
const CES2_1 = require("./CES2");
Object.defineProperty(exports, "CES2", { enumerable: true, get: function () { return CES2_1.CES2; } });
const LD_1 = require("./LD");
Object.defineProperty(exports, "LD", { enumerable: true, get: function () { return LD_1.LD; } });
const NONE_1 = require("./NONE");
Object.defineProperty(exports, "NONE", { enumerable: true, get: function () { return NONE_1.NONE; } });
exports.default = Indicators_1.Indicators;
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAYnB,oFAZA,SAAG,OAYA;AAXZ,+BAA4B;AAWE,oFAXrB,SAAG,OAWqB;AAVjC,iCAA8B;AAUK,qFAV1B,WAAI,OAU0B;AATvC,qCAAkC;AASO,uFAThC,eAAM,OASgC;AAR/C,+BAA4B;AAQqB,oFARxC,SAAG,OAQwC;AAPpD,2CAAwC;AAOc,0FAP7C,qBAAS,OAO6C;AAN/D,iCAA8B;AAM2C,qFANhE,WAAI,OAMgE;AAL7E,6CAA0C;AAC1C,qCAAkC;AAI+B,uFAJxD,eAAM,OAIwD;AAHvE,iCAA8B;AAGhB,qFAHL,WAAI,OAGK;AAFlB,6BAA0B;AAEN,mFAFX,OAAE,OAEW;AADtB,iCAA8B;AACN,qFADf,WAAI,OACe;AAC5B,kBAAe,uBAAU,CAAC"}
import { Rating } from "./Rating";
import { Type } from "./Type";
export declare abstract class Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getRating(score: number): Rating;
isValid(score: number): boolean;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Indicator = void 0;
const Rating_1 = require("./Rating");
const samplingError_1 = require("./samplingError");
class Indicator {
constructor() {
this.negativeMin = 1;
this.negativeMax = 0;
this.neutralMin = 1;
this.neutralMax = 0;
this.positiveMin = 1;
this.positiveMax = 0;
}
getRating(score) {
if (score === null)
return Rating_1.Rating.NONE;
if (this.negativeMin !== null && score >= this.negativeMin && score <= this.negativeMax)
return Rating_1.Rating.NEGATIVE;
if (this.neutralMin !== null && score >= this.neutralMin && score <= this.neutralMax)
return Rating_1.Rating.NEUTRAL;
if (this.positiveMin !== null && score >= this.positiveMin && score <= this.positiveMax)
return Rating_1.Rating.POSITIVE;
else
return Rating_1.Rating.NONE;
}
isValid(score) {
if (score === null)
return false;
if (score >= this.negativeMin && score <= this.positiveMax)
return true;
return false;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives + neutrals;
const score = positives / total;
return score * 100;
}
getSamplingError(total, positives, negatives, neutrals, trustLevel = 1.96) {
const sample = positives + negatives + neutrals;
return samplingError_1.samplingError(sample, total, trustLevel);
}
}
exports.Indicator = Indicator;
//# sourceMappingURL=Indicator.js.map
{"version":3,"file":"Indicator.js","sourceRoot":"","sources":["../src/Indicator.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAClC,mDAAgD;AAGhD,MAAsB,SAAS;IAA/B;QACW,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;QACxB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;IA2BnC,CAAC;IAxBU,SAAS,CAAC,KAAa;QAC1B,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,eAA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"./Type";
export declare class Indicators {
static getIndicator(indicatorType: Type): Indicator;
static fromText(indicator: string): Type;
static toText(indicator: Type): string;
static getFromText(indicator: string): Indicator;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Indicators = void 0;
const CES_1 = require("./CES");
const CES2_1 = require("./CES2");
const CSAT_1 = require("./CSAT");
const CSAT10_1 = require("./CSAT10");
const LD_1 = require("./LD");
const NONE_1 = require("./NONE");
const NPS_1 = require("./NPS");
const NSS_1 = require("./NSS");
const Type_1 = require("./Type");
class Indicators {
static getIndicator(indicatorType) {
switch (indicatorType) {
case Type_1.Type.CSAT:
return new CSAT_1.CSAT();
case Type_1.Type.CSAT10:
return new CSAT10_1.CSAT10();
case Type_1.Type.CES:
return new CES_1.CES();
case Type_1.Type.CES2:
return new CES2_1.CES2();
case Type_1.Type.LD:
return new LD_1.LD();
case Type_1.Type.NONE:
return new NONE_1.NONE();
case Type_1.Type.NSS:
return new NSS_1.NSS();
case Type_1.Type.NPS:
case null:
return new NPS_1.NPS();
}
throw "invalid type";
}
static fromText(indicator) {
switch (indicator.toLowerCase()) {
case "csat":
return Type_1.Type.CSAT;
case "csat10":
return Type_1.Type.CSAT10;
case "ces":
return Type_1.Type.CES;
case "ces2":
return Type_1.Type.CES2;
case "ld":
return Type_1.Type.LD;
case "none":
return Type_1.Type.NONE;
case "nss":
return Type_1.Type.NSS;
case "nps":
case null:
return Type_1.Type.NPS;
}
throw "invalid type";
}
static toText(indicator) {
switch (indicator) {
case Type_1.Type.CSAT:
return "csat";
case Type_1.Type.CSAT10:
return "csat10";
case Type_1.Type.CES:
return "ces";
case Type_1.Type.CES2:
return "ces2";
case Type_1.Type.LD:
return "ld";
case Type_1.Type.NONE:
return "none";
case Type_1.Type.NSS:
return "nss";
case Type_1.Type.NPS:
case null:
return "nps";
}
throw "invalid type";
}
static getFromText(indicator) {
const type = Indicators.fromText(indicator);
return Indicators.getIndicator(type);
}
}
exports.Indicators = Indicators;
//# sourceMappingURL=Indic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EAAE,CAAC;YACnB,KAAK,MAAM;gBACP,OAAO,WAAI,CAAC,IAAI,CAAC;YACrB,KAAK,KAAK;gBACN,OAAO,WAAI,CAAC,GAAG,CAAC;YACpB,KAAK,KAAK,CAAC;YACX,KAAK,IAAI;gBACL,OAAO,WAAI,CAAC,GAAG,CAAC;SACvB;QACD,MAAM,cAAc,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,MAAM,CAAC,SAAe;QAChC,QAAQ,SAAS,EAAE;YACf,KAAK,WAAI,CAAC,IAAI;gBACV,OAAO,MAAM,CAAC;YAClB,KAAK,WAAI,CAAC,MAAM;gBACZ,OAAO,QAAQ,CAAC;YACpB,KAAK,WAAI,CAAC,GAAG;gBACT,OAAO,KAAK,CAAC;YACjB,KAAK,WAAI,CAAC,IAAI;gBACV,OAAO,MAAM,CAAC;YAClB,KAAK,WAAI,CAAC,EAAE;gBACR,OAAO,IAAI,CAAC;YAChB,KAAK,WAAI,CAAC,IAAI;gBACV,OAAO,MAAM,CAAC;YAClB,KAAK,WAAI,CAAC,GAAG;gBACT,OAAO,KAAK,CAAC;YACjB,KAAK,WAAI,CAAC,GAAG,CAAC;YACd,KAAK,IAAI;gBACL,OAAO,KAAK,CAAC;SACpB;QACD,MAAM,cAAc,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,SAAiB;QACvC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACJ;AA1ED,gCA0EC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class LD extends Indicator {
negativeMin: number;
negativeMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LD = void 0;
const Indicator_1 = require("./Indicator");
const samplingError_1 = require("./samplingError");
const Type_1 = require("./Type");
class LD extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = 0;
this.positiveMin = 1;
this.positiveMax = 1;
this.type = Type_1.Type.LD;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives;
const score = positives / total;
return score * 100;
}
getSamplingError(total, positives, negatives, neutrals, trustLevel = 1.96) {
const sample = positives + negatives;
return samplingError_1.samplingError(sample, total, trustLevel);
}
}
exports.LD = LD;
//# sourceMappingURL=LD.js.map
{"version":3,"file":"LD.js","sourceRoot":"","sources":["../src/LD.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mDAAgD;AAChD,iCAA8B;AAC9B,MAAa,EAAG,SAAQ,qBAAS;IAAjC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAEhB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAEhB,SAAI,GAAG,WAAI,CAAC,EAAE,CAAC;IAY1B,CAAC;IAVU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;QACpC,MAAM,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;QAChC,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;IAEM,gBAAgB,CAAC,KAAa,EAAE,SAAiB,EAAE,SAAiB,EAAE,QAAgB,EAAE,aAAqB,IAAI;QACpH,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;QACrC,OAAO,6BAAa,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;CACJ;AAnBD,gBAmBC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class NONE extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NONE = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class NONE extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = -1;
this.neutralMin = 0;
this.neutralMax = 0;
this.positiveMin = 1;
this.positiveMax = 0;
this.type = Type_1.Type.NONE;
}
getScore(positives, negatives, neutrals) {
return 0;
}
}
exports.NONE = NONE;
//# sourceMappingURL=NONE.js.map
{"version":3,"file":"NONE.js","sourceRoot":"","sources":["../src/NONE.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,IAAK,SAAQ,qBAAS;IAAnC;;QACW,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC,CAAC;QACzB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;QACxB,SAAI,GAAG,WAAI,CAAC,IAAI,CAAC;IAK5B,CAAC;IAHU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,OAAO,CAAC,CAAC;IACb,CAAC;CACJ;AAZD,oBAYC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class NPS extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NPS = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class NPS extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = 6;
this.neutralMin = 7;
this.neutralMax = 8;
this.positiveMin = 9;
this.positiveMax = 10;
this.type = Type_1.Type.NPS;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives + neutrals;
const value = (positives - negatives) / total;
return value * 100;
}
getSamplingError(total, positives, negatives, neutrals, trustLevel = 1.96) {
const sampling = positives + neutrals + negatives;
if (sampling < 25)
return 1;
const positivesPercent = positives / sampling;
const neutralsPercent = neutrals / sampling;
const negativesPercent = negatives / sampling;
const nps = positivesPercent - negativesPercent;
const positives2 = Math.pow(1 - nps, 2) * positivesPercent;
const neutrals2 = Math.pow(0 - nps, 2) * neutralsPercent;
const negatives2 = Math.pow(-1 - nps, 2) * negativesPercent;
return Math.min(1, (Math.sqrt(positives2 + neutrals2 + negatives2) / Math.sqrt(sampling)) * trustLevel);
}
}
exports.NPS = NPS;
//# sourceMappingURL=NPS.js.map
{"version":3,"file":"NPS.js","sourceRoot":"","sources":["../src/NPS.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAE9B,MAAa,GAAI,SAAQ,qBAAS;IAAlC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,EAAE,CAAC;QACjB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAwB3B,CAAC;IAtBU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC/C,MAAM,KAAK,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC;QAC9C,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;IAEM,gBAAgB,CAAC,KAAa,EAAE,SAAiB,EAAE,SAAiB,EAAE,QAAgB,EAAE,aAAqB,IAAI;QACpH,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;QAElD,IAAI,QAAQ,GAAG,EAAE;YAAE,OAAO,CAAC,CAAC;QAE5B,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC9C,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;QAC5C,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC9C,MAAM,GAAG,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;QAEhD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC;QAE5D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;IAC5G,CAAC;CACJ;AA/BD,kBA+BC"}
import { NPS } from "./NPS";
import { Type } from "./Type";
export declare class NSS extends NPS {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NSS = void 0;
const NPS_1 = require("./NPS");
const Type_1 = require("./Type");
class NSS extends NPS_1.NPS {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.neutralMin = 4;
this.neutralMax = 4;
this.positiveMin = 5;
this.positiveMax = 5;
this.type = Type_1.Type.NSS;
}
}
exports.NSS = NSS;
//# sourceMappingURL=NSS.js.map
{"version":3,"file":"NSS.js","sourceRoot":"","sources":["../src/NSS.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,iCAA8B;AAE9B,MAAa,GAAI,SAAQ,SAAG;IAA5B;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAC3B,CAAC;CAAA;AARD,kBAQC"}
export declare enum Rating {
NONE = 0,
NEGATIVE = 1,
NEUTRAL = 2,
POSITIVE = 3
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rating = void 0;
var Rating;
(function (Rating) {
Rating[Rating["NONE"] = 0] = "NONE";
Rating[Rating["NEGATIVE"] = 1] = "NEGATIVE";
Rating[Rating["NEUTRAL"] = 2] = "NEUTRAL";
Rating[Rating["POSITIVE"] = 3] = "POSITIVE";
})(Rating = exports.Rating || (exports.Rating = {}));
//# sourceMappingURL=Rating.js.map
{"version":3,"file":"Rating.js","sourceRoot":"","sources":["../src/Rating.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAKX;AALD,WAAY,MAAM;IACd,mCAAQ,CAAA;IACR,2CAAY,CAAA;IACZ,yCAAW,CAAA;IACX,2CAAY,CAAA;AAChB,CAAC,EALW,MAAM,GAAN,cAAM,KAAN,cAAM,QAKjB"}
export declare function samplingError(sample: number, total: number, confidenceLevel: number): number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.samplingError = void 0;
function samplingError(sample, total, confidenceLevel) {
if (sample <= 0 || total <= 1)
return 1;
const size = total - sample;
const confidence = Math.pow(confidenceLevel, 2) * Math.pow(0.5, 2);
return Math.sqrt((size * confidence) / (sample * (total - 1)));
}
exports.samplingError = samplingError;
//# sourceMappingURL=samplingError.js.map
{"version":3,"file":"samplingError.js","sourceRoot":"","sources":["../src/samplingError.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,MAAc,EAAE,KAAa,EAAE,eAAuB;IAChF,IAAI,MAAM,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AALD,sCAKC"}
export declare enum Type {
NPS = 0,
CSAT = 1,
CSAT10 = 2,
CES = 3,
NSS = 4,
CES2 = 5,
LD = 6,
NONE = 20
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Type = void 0;
var Type;
(function (Type) {
Type[Type["NPS"] = 0] = "NPS";
Type[Type["CSAT"] = 1] = "CSAT";
Type[Type["CSAT10"] = 2] = "CSAT10";
Type[Type["CES"] = 3] = "CES";
Type[Type["NSS"] = 4] = "NSS";
Type[Type["CES2"] = 5] = "CES2";
Type[Type["LD"] = 6] = "LD";
Type[Type["NONE"] = 20] = "NONE";
})(Type = exports.Type || (exports.Type = {}));
//# sourceMappingURL=Type.js.map
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../src/Type.ts"],"names":[],"mappings":";;;AAAA,IAAY,IASX;AATD,WAAY,IAAI;IACZ,6BAAO,CAAA;IACP,+BAAQ,CAAA;IACR,mCAAU,CAAA;IACV,6BAAO,CAAA;IACP,6BAAO,CAAA;IACP,+BAAQ,CAAA;IACR,2BAAM,CAAA;IACN,gCAAS,CAAA;AACb,CAAC,EATW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QASf"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export class CES extends Indicator {
public negativeMin = 1;
public negativeMax = 3;
public neutralMin = 4;
public neutralMax = 4;
public positiveMin = 5;
public positiveMax = 7;
public type = Type.CES;
public getScore(positives: number, negatives: number, neutrals: number): number {
const total = positives + negatives + neutrals;
const score = (positives - negatives) / total;
return score * 100;
}
}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export class CES2 extends Indicator {
public negativeMin = 1;
public negativeMax = 3;
public neutralMin = 4;
public neutralMax = 4;
public positiveMin = 5;
public positiveMax = 7;
public type = Type.CES;
}
import { Indicator } from "./Indicator";
import { samplingError } from "./samplingError";
import { Type } from "./Type";
export class CSAT extends Indicator {
public negativeMin = 1;
public negativeMax = 3;
public positiveMin = 4;
public positiveMax = 5;
public type = Type.CSAT;
public getScore(positives: number, negatives: number, neutrals: number): number {
const total = positives + negatives;
const score = positives / total;
return score * 100;
}
public getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel: number = 1.96): number {
return samplingError(positives + negatives, total, trustLevel);
}
}
import { CSAT } from "./CSAT";
import { Type } from "./Type";
export class CSAT10 extends CSAT {
public negativeMin = 0;
public negativeMax = 6;
public positiveMin = 7;
public positiveMax = 10;
public type = Type.CSAT10;
}
import { NPS } from "./NPS";
import { CES } from "./CES";
import { CSAT } from "./CSAT";
import { CSAT10 } from "./CSAT10";
import { NSS } from "./NSS";
import { Indicator } from "./Indicator";
import { Type } from "./Type";
import { Indicators } from "./Indicators";
import { Rating } from "./Rating";
import { CES2 } from "./CES2";
import { LD } from "./LD";
import { NONE } from "./NONE";
export { NPS, CES2, LD, NONE, CES, CSAT, CSAT10, NSS, Indicator, Rating, Type };
export default Indicators;
import { Rating } from "./Rating";
import { samplingError } from "./samplingError";
import { Type } from "./Type";
export abstract class Indicator {
public negativeMin: number = 1;
public negativeMax: number = 0;
public neutralMin: number = 1;
public neutralMax: number = 0;
public positiveMin: number = 1;
public positiveMax: number = 0;
public type: Type;
public getRating(score: number): Rating {
if (score === null) return Rating.NONE;
if (this.negativeMin !== null && score >= this.negativeMin && score <= this.negativeMax) return Rating.NEGATIVE;
if (this.neutralMin !== null && score >= this.neutralMin && score <= this.neutralMax) return Rating.NEUTRAL;
if (this.positiveMin !== null && score >= this.positiveMin && score <= this.positiveMax) return Rating.POSITIVE;
else return Rating.NONE;
}
public isValid(score: number): boolean {
if (score === null) return false;
if (score >= this.negativeMin && score <= this.positiveMax) return true;
return false;
}
public getScore(positives: number, negatives: number, neutrals: number): number {
const total = positives + negatives + neutrals;
const score = positives / total;
return score * 100;
}
public getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel: number = 1.96): number {
const sample = positives + negatives + neutrals;
return samplingError(sample, total, trustLevel);
}
}
import { CES } from "./CES";
import { CES2 } from "./CES2";
import { CSAT } from "./CSAT";
import { CSAT10 } from "./CSAT10";
import { Indicator } from "./Indicator";
import { LD } from "./LD";
import { NONE } from "./NONE";
import { NPS } from "./NPS";
import { NSS } from "./NSS";
import { Type } from "./Type";
export class Indicators {
public static getIndicator(indicatorType: Type): Indicator {
switch (indicatorType) {
case Type.CSAT:
return new CSAT();
case Type.CSAT10:
return new CSAT10();
case Type.CES:
return new CES();
case Type.CES2:
return new CES2();
case Type.LD:
return new LD();
case Type.NONE:
return new NONE();
case Type.NSS:
return new NSS();
case Type.NPS:
case null:
return new NPS();
}
throw "invalid type";
}
public static fromText(indicator: string): Type {
switch (indicator.toLowerCase()) {
case "csat":
return Type.CSAT;
case "csat10":
return Type.CSAT10;
case "ces":
return Type.CES;
case "ces2":
return Type.CES2;
case "ld":
return Type.LD;
case "none":
return Type.NONE;
case "nss":
return Type.NSS;
case "nps":
case null:
return Type.NPS;
}
throw "invalid type";
}
public static toText(indicator: Type): string {
switch (indicator) {
case Type.CSAT:
return "csat";
case Type.CSAT10:
return "csat10";
case Type.CES:
return "ces";
case Type.CES2:
return "ces2";
case Type.LD:
return "ld";
case Type.NONE:
return "none";
case Type.NSS:
return "nss";
case Type.NPS:
case null:
return "nps";
}
throw "invalid type";
}
public static getFromText(indicator: string) {
const type = Indicators.fromText(indicator);
return Indicators.getIndicator(type);
}
}
import { Indicator } from "./Indicator";
import { samplingError } from "./samplingError";
import { Type } from "./Type";
export class LD extends Indicator {
public negativeMin = 0;
public negativeMax = 0;
public positiveMin = 1;
public positiveMax = 1;
public type = Type.LD;
public getScore(positives: number, negatives: number, neutrals: number): number {
const total = positives + negatives;
const score = positives / total;
return score * 100;
}
public getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel: number = 1.96): number {
const sample = positives + negatives;
return samplingError(sample, total, trustLevel);
}
}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export class NONE extends Indicator {
public negativeMin: number = 0;
public negativeMax: number = -1;
public neutralMin: number = 0;
public neutralMax: number = 0;
public positiveMin: number = 1;
public positiveMax: number = 0;
public type = Type.NONE;
public getScore(positives: number, negatives: number, neutrals: number): number {
return 0;
}
}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export class NPS extends Indicator {
public negativeMin = 0;
public negativeMax = 6;
public neutralMin = 7;
public neutralMax = 8;
public positiveMin = 9;
public positiveMax = 10;
public type = Type.NPS;
public getScore(positives: number, negatives: number, neutrals: number): number {
const total = positives + negatives + neutrals;
const value = (positives - negatives) / total;
return value * 100;
}
public getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel: number = 1.96): number {
const sampling = positives + neutrals + negatives;
if (sampling < 25) return 1;
const positivesPercent = positives / sampling;
const neutralsPercent = neutrals / sampling;
const negativesPercent = negatives / sampling;
const nps = positivesPercent - negativesPercent;
const positives2 = Math.pow(1 - nps, 2) * positivesPercent;
const neutrals2 = Math.pow(0 - nps, 2) * neutralsPercent;
const negatives2 = Math.pow(-1 - nps, 2) * negativesPercent;
return Math.min(1, (Math.sqrt(positives2 + neutrals2 + negatives2) / Math.sqrt(sampling)) * trustLevel);
}
}
import { NPS } from "./NPS";
import { Type } from "./Type";
export class NSS extends NPS {
public negativeMin = 1;
public negativeMax = 3;
public neutralMin = 4;
public neutralMax = 4;
public positiveMin = 5;
public positiveMax = 5;
public type = Type.NSS;
}
export enum Rating {
NONE = 0,
NEGATIVE = 1,
NEUTRAL = 2,
POSITIVE = 3
}
export function samplingError(sample: number, total: number, confidenceLevel: number): number {
if (sample <= 0 || total <= 1) return 1;
const size = total - sample;
const confidence = Math.pow(confidenceLevel, 2) * Math.pow(0.5, 2);
return Math.sqrt((size * confidence) / (sample * (total - 1)));
}
export enum Type {
NPS = 0,
CSAT = 1,
CSAT10 = 2,
CES = 3,
NSS = 4,
CES2 = 5,
LD = 6,
NONE = 20
}
+32
-27
{
"name": "@solucx/indicators",
"version": "1.0.4",
"description": "",
"version": "1.1.0",
"description": "SoluCX Indicators",
"main": "build/index.js",
"types": "build/index.d.ts",
"author": "SoluCX",
"license": "ISC",
"homepage": "https://bitbucket.org/solucxteam/solucx-typescript-sdk#readme",
"files": [
"dist/**/*"
"build/**/*",
"src/**/*"
],
"types": "dist/index.d.ts",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+ssh://git@bitbucket.org/solucxteam/solucx-typescript-sdk.git"
},
"keywords": [
"solucx"
],
"scripts": {
"test": "jest --maxWorkers=50%",
"test:cov": "jest --coverage --maxWorkers=50%",
"build": "rimraf dist/** && tsc -p tsconfig.build.json",
"clear": "rimraf dist/** && jest --clear-cache",
"lint2": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"build": "tsc",
"test": "jest",
"lint": "tslint -p tsconfig.json",
"format": "prettier --write \"src/**/*.ts\"",
"test:cov": "jest --coverage",
"prepare": "npm run build",

@@ -22,19 +31,13 @@ "prepublishOnly": "npm run lint",

"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
"postversion": "git push && git push --tags",
"patch": "npm version patch"
},
"author": "",
"license": "ISC",
"dependencies": {
"jstat": "^1.9.4",
"typescript": "^3.9.3"
},
"devDependencies": {
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.24.1",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.5",
"typescript": "^4.3.5",
"@types/jest": "^25.2.3",
"jest": "^26.0.1",
"ts-jest": "^26.1.0",
"tslint": "^6.1.3",

@@ -50,2 +53,5 @@ "tslint-config-prettier": "^1.18.0"

"rootDir": ".",
"reporters": [
"default"
],
"modulePaths": [

@@ -63,4 +69,3 @@ "<rootDir>/src/"

"testEnvironment": "node"
},
"dependencies": {}
}
}

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

# @solucx/Indicators
# solucx/sdk
Contains logic for KPI Indicators
SoluCX Indicators
## Usage
To install this package use `npm install @solucx/indicators --save`
To install this packege use `npm install @solucx/indicators`

@@ -23,3 +23,3 @@ ### Test

- you have to logged in npm (`npm login`)
- you should have access to the npm package (`https://www.npmjs.com/package/@solucx/...`)
- you should have access to the npm package (`https://www.npmjs.com/package/@solucx/sdk`)
3. `git push --tags`
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class CES extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CES = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class CES extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.neutralMin = 4;
this.neutralMax = 4;
this.positiveMin = 5;
this.positiveMax = 7;
this.type = Type_1.Type.CES;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives + neutrals;
const score = (positives - negatives) / total;
return score * 100;
}
}
exports.CES = CES;
//# sourceMappingURL=CES.js.map
{"version":3,"file":"CES.js","sourceRoot":"","sources":["../src/CES.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,GAAI,SAAQ,qBAAS;IAAlC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAO3B,CAAC;IALU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC/C,MAAM,KAAK,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC;QAC9C,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;CACJ;AAdD,kBAcC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class CES2 extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CES2 = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class CES2 extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.neutralMin = 4;
this.neutralMax = 4;
this.positiveMin = 5;
this.positiveMax = 7;
this.type = Type_1.Type.CES;
}
}
exports.CES2 = CES2;
//# sourceMappingURL=CES2.js.map
{"version":3,"file":"CES2.js","sourceRoot":"","sources":["../src/CES2.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,IAAK,SAAQ,qBAAS;IAAnC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAC3B,CAAC;CAAA;AARD,oBAQC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class CSAT extends Indicator {
negativeMin: number;
negativeMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSAT = void 0;
const Indicator_1 = require("./Indicator");
const samplingError_1 = require("./samplingError");
const Type_1 = require("./Type");
class CSAT extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.positiveMin = 4;
this.positiveMax = 5;
this.type = Type_1.Type.CSAT;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives;
const score = positives / total;
return score * 100;
}
getSamplingError(total, positives, negatives, neutrals, trustLevel = 1.96) {
return samplingError_1.samplingError(positives + negatives, total, trustLevel);
}
}
exports.CSAT = CSAT;
//# sourceMappingURL=CSAT.js.map
{"version":3,"file":"CSAT.js","sourceRoot":"","sources":["../src/CSAT.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mDAAgD;AAChD,iCAA8B;AAC9B,MAAa,IAAK,SAAQ,qBAAS;IAAnC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,IAAI,CAAC;IAgB5B,CAAC;IAdU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;QACpC,MAAM,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;QAChC,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;IACM,gBAAgB,CACnB,KAAa,EACb,SAAiB,EACjB,SAAiB,EACjB,QAAgB,EAChB,aAAqB,IAAI;QAEzB,OAAO,6BAAa,CAAC,SAAS,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACnE,CAAC;CACJ;AArBD,oBAqBC"}
import { CSAT } from "./CSAT";
import { Type } from "./Type";
export declare class CSAT10 extends CSAT {
negativeMin: number;
negativeMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSAT10 = void 0;
const CSAT_1 = require("./CSAT");
const Type_1 = require("./Type");
class CSAT10 extends CSAT_1.CSAT {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = 6;
this.positiveMin = 7;
this.positiveMax = 10;
this.type = Type_1.Type.CSAT10;
}
}
exports.CSAT10 = CSAT10;
//# sourceMappingURL=CSAT10.js.map
{"version":3,"file":"CSAT10.js","sourceRoot":"","sources":["../src/CSAT10.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,iCAA8B;AAC9B,MAAa,MAAO,SAAQ,WAAI;IAAhC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,EAAE,CAAC;QACjB,SAAI,GAAG,WAAI,CAAC,MAAM,CAAC;IAC9B,CAAC;CAAA;AAND,wBAMC"}
import { NPS } from "./NPS";
import { CES } from "./CES";
import { CSAT } from "./CSAT";
import { CSAT10 } from "./CSAT10";
import { NSS } from "./NSS";
import { Indicator } from "./Indicator";
import { Type } from "./Type";
import { Indicators } from "./Indicators";
import { Rating } from "./Rating";
import { CES2 } from "./CES2";
import { LD } from "./LD";
import { NONE } from "./NONE";
export { NPS, CES2, LD, NONE, CES, CSAT, CSAT10, NSS, Indicator, Rating, Type };
export default Indicators;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Type = exports.Rating = exports.Indicator = exports.NSS = exports.CSAT10 = exports.CSAT = exports.CES = exports.NONE = exports.LD = exports.CES2 = exports.NPS = void 0;
const NPS_1 = require("./NPS");
Object.defineProperty(exports, "NPS", { enumerable: true, get: function () { return NPS_1.NPS; } });
const CES_1 = require("./CES");
Object.defineProperty(exports, "CES", { enumerable: true, get: function () { return CES_1.CES; } });
const CSAT_1 = require("./CSAT");
Object.defineProperty(exports, "CSAT", { enumerable: true, get: function () { return CSAT_1.CSAT; } });
const CSAT10_1 = require("./CSAT10");
Object.defineProperty(exports, "CSAT10", { enumerable: true, get: function () { return CSAT10_1.CSAT10; } });
const NSS_1 = require("./NSS");
Object.defineProperty(exports, "NSS", { enumerable: true, get: function () { return NSS_1.NSS; } });
const Indicator_1 = require("./Indicator");
Object.defineProperty(exports, "Indicator", { enumerable: true, get: function () { return Indicator_1.Indicator; } });
const Type_1 = require("./Type");
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return Type_1.Type; } });
const Indicators_1 = require("./Indicators");
const Rating_1 = require("./Rating");
Object.defineProperty(exports, "Rating", { enumerable: true, get: function () { return Rating_1.Rating; } });
const CES2_1 = require("./CES2");
Object.defineProperty(exports, "CES2", { enumerable: true, get: function () { return CES2_1.CES2; } });
const LD_1 = require("./LD");
Object.defineProperty(exports, "LD", { enumerable: true, get: function () { return LD_1.LD; } });
const NONE_1 = require("./NONE");
Object.defineProperty(exports, "NONE", { enumerable: true, get: function () { return NONE_1.NONE; } });
exports.default = Indicators_1.Indicators;
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAYnB,oFAZA,SAAG,OAYA;AAXZ,+BAA4B;AAWE,oFAXrB,SAAG,OAWqB;AAVjC,iCAA8B;AAUK,qFAV1B,WAAI,OAU0B;AATvC,qCAAkC;AASO,uFAThC,eAAM,OASgC;AAR/C,+BAA4B;AAQqB,oFARxC,SAAG,OAQwC;AAPpD,2CAAwC;AAOc,0FAP7C,qBAAS,OAO6C;AAN/D,iCAA8B;AAM2C,qFANhE,WAAI,OAMgE;AAL7E,6CAA0C;AAC1C,qCAAkC;AAI+B,uFAJxD,eAAM,OAIwD;AAHvE,iCAA8B;AAGhB,qFAHL,WAAI,OAGK;AAFlB,6BAA0B;AAEN,mFAFX,OAAE,OAEW;AADtB,iCAA8B;AACN,qFADf,WAAI,OACe;AAC5B,kBAAe,uBAAU,CAAC"}
import { Rating } from "./Rating";
import { Type } from "./Type";
export declare abstract class Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getRating(score: number): Rating;
isValid(score: number): boolean;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, negatives: number, neutrals: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Indicator = void 0;
const Rating_1 = require("./Rating");
const samplingError_1 = require("./samplingError");
class Indicator {
constructor() {
this.negativeMin = 1;
this.negativeMax = 0;
this.neutralMin = 1;
this.neutralMax = 0;
this.positiveMin = 1;
this.positiveMax = 0;
}
getRating(score) {
if (score === null)
return Rating_1.Rating.NONE;
if (this.negativeMin !== null && score >= this.negativeMin && score <= this.negativeMax)
return Rating_1.Rating.NEGATIVE;
if (this.neutralMin !== null && score >= this.neutralMin && score <= this.neutralMax)
return Rating_1.Rating.NEUTRAL;
if (this.positiveMin !== null && score >= this.positiveMin && score <= this.positiveMax)
return Rating_1.Rating.POSITIVE;
else
return Rating_1.Rating.NONE;
}
isValid(score) {
if (score === null)
return false;
if (score >= this.negativeMin && score <= this.positiveMax)
return true;
return false;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives + neutrals;
const score = positives / total;
return score * 100;
}
getSamplingError(total, positives, negatives, neutrals, trustLevel = 1.96) {
const sample = positives + negatives + neutrals;
return samplingError_1.samplingError(sample, total, trustLevel);
}
}
exports.Indicator = Indicator;
//# sourceMappingURL=Indicator.js.map
{"version":3,"file":"Indicator.js","sourceRoot":"","sources":["../src/Indicator.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAClC,mDAAgD;AAGhD,MAAsB,SAAS;IAA/B;QACW,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;QACxB,eAAU,GAAW,CAAC,CAAC;QACvB,eAAU,GAAW,CAAC,CAAC;QACvB,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;IAiCnC,CAAC;IA9BU,SAAS,CAAC,KAAa;QAC1B,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,eAAM,CAAC,IAAI,CAAC;QACvC,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,eAAM,CAAC,QAAQ,CAAC;QAChH,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO,eAAM,CAAC,OAAO,CAAC;QAC5G,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,eAAM,CAAC,QAAQ,CAAC;;YAC3G,OAAO,eAAM,CAAC,IAAI,CAAC;IAC5B,CAAC;IAEM,OAAO,CAAC,KAAa;QACxB,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACjC,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QACxE,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;QAC/C,MAAM,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;QAChC,OAAO,KAAK,GAAG,GAAG,CAAC;IACvB,CAAC;IAEM,gBAAgB,CACnB,KAAa,EACb,SAAiB,EACjB,SAAiB,EACjB,QAAgB,EAChB,aAAqB,IAAI;QAEzB,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;QAChD,OAAO,6BAAa,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;CACJ;AAvCD,8BAuCC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class Indicators {
static getIndicator(indicatorType: Type): Indicator;
static fromText(indicator: string): Type;
static toText(indicator: Type): string;
static getFromText(indicator: string): Indicator;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Indicators = void 0;
const CES_1 = require("./CES");
const CES2_1 = require("./CES2");
const CSAT_1 = require("./CSAT");
const CSAT10_1 = require("./CSAT10");
const LD_1 = require("./LD");
const NONE_1 = require("./NONE");
const NPS_1 = require("./NPS");
const NSS_1 = require("./NSS");
const Type_1 = require("./Type");
class Indicators {
static getIndicator(indicatorType) {
switch (indicatorType) {
case Type_1.Type.CSAT:
return new CSAT_1.CSAT();
case Type_1.Type.CSAT10:
return new CSAT10_1.CSAT10();
case Type_1.Type.CES:
return new CES_1.CES();
case Type_1.Type.CES2:
return new CES2_1.CES2();
case Type_1.Type.LD:
return new LD_1.LD();
case Type_1.Type.NONE:
return new NONE_1.NONE();
case Type_1.Type.NSS:
return new NSS_1.NSS();
case Type_1.Type.NPS:
case null:
return new NPS_1.NPS();
}
throw "invalid type";
}
static fromText(indicator) {
switch (indicator.toLowerCase()) {
case "csat":
return Type_1.Type.CSAT;
case "csat10":
return Type_1.Type.CSAT10;
case "ces":
return Type_1.Type.CES;
case "ces2":
return Type_1.Type.CES2;
case "ld":
return Type_1.Type.LD;
case "none":
return Type_1.Type.NONE;
case "nss":
return Type_1.Type.NSS;
case "nps":
case null:
return Type_1.Type.NPS;
}
throw "invalid type";
}
static toText(indicator) {
switch (indicator) {
case Type_1.Type.CSAT:
return "csat";
case Type_1.Type.CSAT10:
return "csat10";
case Type_1.Type.CES:
return "ces";
case Type_1.Type.CES2:
return "ces2";
case Type_1.Type.LD:
return "ld";
case Type_1.Type.NONE:
return "none";
case Type_1.Type.NSS:
return "nss";
case Type_1.Type.NPS:
case null:
return "nps";
}
throw "invalid type";
}
static getFromText(indicator) {
const type = Indicators.fromText(indicator);
return Indicators.getIndicator(type);
}
}
exports.Indicators = Indicators;
//# sourceMappingURL=Indicators.js.map
{"version":3,"file":"Indicators.js","sourceRoot":"","sources":["../src/Indicators.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,iCAA8B;AAC9B,iCAA8B;AAC9B,qCAAkC;AAElC,6BAA0B;AAC1B,iCAA8B;AAC9B,+BAA4B;AAC5B,+BAA4B;AAC5B,iCAA8B;AAE9B,MAAa,UAAU;IACZ,MAAM,CAAC,YAAY,CAAC,aAAmB;QAC1C,QAAQ,aAAa,EAAE;YACnB,KAAK,WAAI,CAAC,IAAI;gBACV,OAAO,IAAI,WAAI,EAAE,CAAC;YACtB,KAAK,WAAI,CAAC,MAAM;gBACZ,OAAO,IAAI,eAAM,EAAE,CAAC;YACxB,KAAK,WAAI,CAAC,GAAG;gBACT,OAAO,IAAI,SAAG,EAAE,CAAC;YACrB,KAAK,WAAI,CAAC,IAAI;gBACV,OAAO,IAAI,WAAI,EAAE,CAAC;YACtB,KAAK,WAAI,CAAC,EAAE;gBACR,OAAO,IAAI,OAAE,EAAE,CAAC;YACpB,KAAK,WAAI,CAAC,IAAI;gBACV,OAAO,IAAI,WAAI,EAAE,CAAC;YACtB,KAAK,WAAI,CAAC,GAAG;gBACT,O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I;gBACL,OAAO,KAAK,CAAC;SACpB;QACD,MAAM,cAAc,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,SAAiB;QACvC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACJ;AA1ED,gCA0EC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class LD extends Indicator {
negativeMin: number;
negativeMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LD = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class LD extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = 0;
this.positiveMin = 1;
this.positiveMax = 1;
this.type = Type_1.Type.LD;
}
}
exports.LD = LD;
//# sourceMappingURL=LD.js.map
{"version":3,"file":"LD.js","sourceRoot":"","sources":["../src/LD.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,EAAG,SAAQ,qBAAS;IAAjC;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAEhB,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAEhB,SAAI,GAAG,WAAI,CAAC,EAAE,CAAC;IAC1B,CAAC;CAAA;AARD,gBAQC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class NONE extends Indicator {
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NONE = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class NONE extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.type = Type_1.Type.NONE;
}
getScore(positives, negatives, neutrals) {
return 0;
}
}
exports.NONE = NONE;
//# sourceMappingURL=NONE.js.map
{"version":3,"file":"NONE.js","sourceRoot":"","sources":["../src/NONE.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,iCAA8B;AAC9B,MAAa,IAAK,SAAQ,qBAAS;IAAnC;;QACW,SAAI,GAAG,WAAI,CAAC,IAAI,CAAC;IAI5B,CAAC;IAHU,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,QAAgB;QAClE,OAAO,CAAC,CAAC;IACb,CAAC;CACJ;AALD,oBAKC"}
import { Indicator } from "./Indicator";
import { Type } from "./Type";
export declare class NPS extends Indicator {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
getScore(positives: number, negatives: number, neutrals: number): number;
getSamplingError(total: number, positives: number, neutrals: number, negatives: number, trustLevel?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NPS = void 0;
const Indicator_1 = require("./Indicator");
const Type_1 = require("./Type");
class NPS extends Indicator_1.Indicator {
constructor() {
super(...arguments);
this.negativeMin = 0;
this.negativeMax = 6;
this.neutralMin = 7;
this.neutralMax = 8;
this.positiveMin = 9;
this.positiveMax = 10;
this.type = Type_1.Type.NPS;
}
getScore(positives, negatives, neutrals) {
const total = positives + negatives + neutrals;
const value = (positives - negatives) / total;
return value * 100;
}
getSamplingError(total, positives, neutrals, negatives, trustLevel = 1.96) {
const sampling = positives + neutrals + negatives;
if (sampling < 25)
return 1;
const positivesPercent = positives / sampling;
const neutralsPercent = neutrals / sampling;
const negativesPercent = negatives / sampling;
const nps = positivesPercent - negativesPercent;
const positives2 = Math.pow(1 - nps, 2) * positivesPercent;
const neutrals2 = Math.pow(0 - nps, 2) * neutralsPercent;
const negatives2 = Math.pow(-1 - nps, 2) * negativesPercent;
return Math.min(1, (Math.sqrt(positives2 + neutrals2 + negatives2) / Math.sqrt(sampling)) * trustLevel);
}
}
exports.NPS = NPS;
//# sourceMappingURL=NPS.js.map
{"version":3,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D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC;QAE5D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;IAC5G,CAAC;CACJ;AArCD,kBAqCC"}
import { NPS } from "./NPS";
import { Type } from "./Type";
export declare class NSS extends NPS {
negativeMin: number;
negativeMax: number;
neutralMin: number;
neutralMax: number;
positiveMin: number;
positiveMax: number;
type: Type;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NSS = void 0;
const NPS_1 = require("./NPS");
const Type_1 = require("./Type");
class NSS extends NPS_1.NPS {
constructor() {
super(...arguments);
this.negativeMin = 1;
this.negativeMax = 3;
this.neutralMin = 4;
this.neutralMax = 4;
this.positiveMin = 5;
this.positiveMax = 5;
this.type = Type_1.Type.NSS;
}
}
exports.NSS = NSS;
//# sourceMappingURL=NSS.js.map
{"version":3,"file":"NSS.js","sourceRoot":"","sources":["../src/NSS.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,iCAA8B;AAE9B,MAAa,GAAI,SAAQ,SAAG;IAA5B;;QACW,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,eAAU,GAAG,CAAC,CAAC;QACf,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,gBAAW,GAAG,CAAC,CAAC;QAChB,SAAI,GAAG,WAAI,CAAC,GAAG,CAAC;IAC3B,CAAC;CAAA;AARD,kBAQC"}
export declare enum Rating {
NONE = 0,
NEGATIVE = 1,
NEUTRAL = 2,
POSITIVE = 3
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rating = void 0;
var Rating;
(function (Rating) {
Rating[Rating["NONE"] = 0] = "NONE";
Rating[Rating["NEGATIVE"] = 1] = "NEGATIVE";
Rating[Rating["NEUTRAL"] = 2] = "NEUTRAL";
Rating[Rating["POSITIVE"] = 3] = "POSITIVE";
})(Rating = exports.Rating || (exports.Rating = {}));
//# sourceMappingURL=Rating.js.map
{"version":3,"file":"Rating.js","sourceRoot":"","sources":["../src/Rating.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAKX;AALD,WAAY,MAAM;IACd,mCAAQ,CAAA;IACR,2CAAY,CAAA;IACZ,yCAAW,CAAA;IACX,2CAAY,CAAA;AAChB,CAAC,EALW,MAAM,GAAN,cAAM,KAAN,cAAM,QAKjB"}
export declare function samplingError(sample: number, total: number, trustLevel: number): number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.samplingError = void 0;
function samplingError(sample, total, trustLevel) {
if (sample <= 0 || total <= 1)
return 1;
const result = Math.sqrt(((total - sample) * Math.pow(trustLevel, 2) * Math.pow(0.5, 2)) / (sample * (total - 1)));
return result;
}
exports.samplingError = samplingError;
//# sourceMappingURL=samplingError.js.map
{"version":3,"file":"samplingError.js","sourceRoot":"","sources":["../src/samplingError.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,MAAc,EAAE,KAAa,EAAE,UAAkB;IAC3E,IAAI,MAAM,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnH,OAAO,MAAM,CAAC;AAClB,CAAC;AAJD,sCAIC"}

Sorry, the diff of this file is not supported yet

export declare enum Type {
NPS = 0,
CSAT = 1,
CSAT10 = 2,
CES = 3,
NSS = 4,
CES2 = 5,
LD = 6,
NONE = 20
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Type = void 0;
var Type;
(function (Type) {
Type[Type["NPS"] = 0] = "NPS";
Type[Type["CSAT"] = 1] = "CSAT";
Type[Type["CSAT10"] = 2] = "CSAT10";
Type[Type["CES"] = 3] = "CES";
Type[Type["NSS"] = 4] = "NSS";
Type[Type["CES2"] = 5] = "CES2";
Type[Type["LD"] = 6] = "LD";
Type[Type["NONE"] = 20] = "NONE";
})(Type = exports.Type || (exports.Type = {}));
//# sourceMappingURL=Type.js.map
{"version":3,"file":"Type.js","sourceRoot":"","sources":["../src/Type.ts"],"names":[],"mappings":";;;AAAA,IAAY,IASX;AATD,WAAY,IAAI;IACZ,6BAAO,CAAA;IACP,+BAAQ,CAAA;IACR,mCAAU,CAAA;IACV,6BAAO,CAAA;IACP,6BAAO,CAAA;IACP,+BAAQ,CAAA;IACR,2BAAM,CAAA;IACN,gCAAS,CAAA;AACb,CAAC,EATW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QASf"}