@wix/site-service-experiments 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/cjs/build/definition/index.d.ts +17 -0
- package/cjs/build/definition/index.js +6 -0
- package/cjs/build/definition/index.js.map +1 -0
- package/cjs/build/implementations/experimentsService.d.ts +6 -0
- package/cjs/build/implementations/experimentsService.js +18 -0
- package/cjs/build/implementations/experimentsService.js.map +1 -0
- package/cjs/build/implementations/index.d.ts +1 -0
- package/cjs/build/implementations/index.js +18 -0
- package/cjs/build/implementations/index.js.map +1 -0
- package/cjs/build/index.d.ts +2 -0
- package/cjs/build/index.js +19 -0
- package/cjs/build/index.js.map +1 -0
- package/cjs/build/service.d.ts +7 -0
- package/cjs/build/service.js +8 -0
- package/cjs/build/service.js.map +1 -0
- package/cjs/build/types/index.d.ts +1 -0
- package/cjs/build/types/index.js +3 -0
- package/cjs/build/types/index.js.map +1 -0
- package/cjs/package.json +3 -0
- package/definition/package.json +3 -0
- package/dist/definition/index.d.ts +17 -0
- package/dist/definition/index.js +3 -0
- package/dist/definition/index.js.map +1 -0
- package/dist/implementations/experimentsService.d.ts +6 -0
- package/dist/implementations/experimentsService.js +15 -0
- package/dist/implementations/experimentsService.js.map +1 -0
- package/dist/implementations/index.d.ts +1 -0
- package/dist/implementations/index.js +2 -0
- package/dist/implementations/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/service.d.ts +7 -0
- package/dist/service.js +5 -0
- package/dist/service.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/implementations/package.json +3 -0
- package/package.json +82 -0
- package/src/definition/index.ts +21 -0
- package/src/implementations/experimentsService.ts +21 -0
- package/src/implementations/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/service.ts +5 -0
- package/src/types/index.ts +1 -0
- package/types/package.json +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# @wix/site-service-experiments
|
|
2
|
+
|
|
3
|
+
> ⚠️ **No API stability guarantee.** This package is published to support Wix products and is provided as-is. Its API may change or be removed at any time without notice, and it does not follow semver compatibility guarantees. Use at your own risk.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServiceDefinition } from '@wix/services-definitions';
|
|
2
|
+
export type Experiments = {
|
|
3
|
+
[experimentName: string]: string | boolean;
|
|
4
|
+
};
|
|
5
|
+
export type IExperimentsServiceConfig = {
|
|
6
|
+
experiments?: Experiments;
|
|
7
|
+
};
|
|
8
|
+
export interface IExperimentsService {
|
|
9
|
+
readonly all: Experiments;
|
|
10
|
+
isOpen(name: string): boolean;
|
|
11
|
+
}
|
|
12
|
+
export type IExperimentsDefinition = ServiceDefinition<IExperimentsService, IExperimentsServiceConfig>;
|
|
13
|
+
export declare const ExperimentsDefinition: string & {
|
|
14
|
+
__api: IExperimentsService;
|
|
15
|
+
__config: IExperimentsServiceConfig;
|
|
16
|
+
isServiceDefinition?: boolean;
|
|
17
|
+
} & IExperimentsService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExperimentsDefinition = void 0;
|
|
4
|
+
const services_definitions_1 = require("@wix/services-definitions");
|
|
5
|
+
exports.ExperimentsDefinition = (0, services_definitions_1.defineService)('@wix/site-service-experiments');
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAkB5C,QAAA,qBAAqB,GAAG,IAAA,oCAAa,EAC9C,+BAA+B,CAClC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExperimentsService, IExperimentsServiceConfig } from '../definition';
|
|
2
|
+
export declare const ExperimentsService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
3
|
+
__api: IExperimentsService;
|
|
4
|
+
__config: IExperimentsServiceConfig;
|
|
5
|
+
isServiceDefinition?: boolean;
|
|
6
|
+
} & IExperimentsService, IExperimentsServiceConfig>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExperimentsService = void 0;
|
|
4
|
+
const services_definitions_1 = require("@wix/services-definitions");
|
|
5
|
+
const definition_1 = require("../definition");
|
|
6
|
+
exports.ExperimentsService = (0, services_definitions_1.implementService)(definition_1.ExperimentsDefinition, ({ config }) => {
|
|
7
|
+
const _experiments = config.experiments ?? {};
|
|
8
|
+
return {
|
|
9
|
+
get all() {
|
|
10
|
+
return _experiments;
|
|
11
|
+
},
|
|
12
|
+
isOpen(name) {
|
|
13
|
+
const value = _experiments[name];
|
|
14
|
+
return value === true || value === 'true' || value === 'B';
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=experimentsService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimentsService.js","sourceRoot":"","sources":["../../../src/implementations/experimentsService.ts"],"names":[],"mappings":";;;AAAA,oEAA4D;AAG5D,8CAAqD;AAExC,QAAA,kBAAkB,GAAG,IAAA,uCAAgB,EAC9C,kCAAqB,EACrB,CAAC,EAAE,MAAM,EAAiD,EAAuB,EAAE;IAC/E,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE,CAAA;IAE7C,OAAO;QACH,IAAI,GAAG;YACH,OAAO,YAAY,CAAA;QACvB,CAAC;QACD,MAAM,CAAC,IAAY;YACf,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;YAChC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAA;QAC9D,CAAC;KACJ,CAAA;AACL,CAAC,CACJ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './experimentsService';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./experimentsService"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/implementations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./definition"), exports);
|
|
18
|
+
__exportStar(require("./implementations"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,oDAAiC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExperimentsService } from './implementations/experimentsService';
|
|
2
|
+
export declare const definition: string & {
|
|
3
|
+
__api: import("./definition").IExperimentsService;
|
|
4
|
+
__config: import("./definition").IExperimentsServiceConfig;
|
|
5
|
+
isServiceDefinition?: boolean;
|
|
6
|
+
} & import("./definition").IExperimentsService;
|
|
7
|
+
export default ExperimentsService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.definition = void 0;
|
|
4
|
+
const definition_1 = require("./definition");
|
|
5
|
+
const experimentsService_1 = require("./implementations/experimentsService");
|
|
6
|
+
exports.definition = definition_1.ExperimentsDefinition;
|
|
7
|
+
exports.default = experimentsService_1.ExperimentsService;
|
|
8
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AACpD,6EAAyE;AAE5D,QAAA,UAAU,GAAG,kCAAqB,CAAA;AAC/C,kBAAe,uCAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IExperimentsService, IExperimentsServiceConfig, IExperimentsDefinition } from '../definition';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServiceDefinition } from '@wix/services-definitions';
|
|
2
|
+
export type Experiments = {
|
|
3
|
+
[experimentName: string]: string | boolean;
|
|
4
|
+
};
|
|
5
|
+
export type IExperimentsServiceConfig = {
|
|
6
|
+
experiments?: Experiments;
|
|
7
|
+
};
|
|
8
|
+
export interface IExperimentsService {
|
|
9
|
+
readonly all: Experiments;
|
|
10
|
+
isOpen(name: string): boolean;
|
|
11
|
+
}
|
|
12
|
+
export type IExperimentsDefinition = ServiceDefinition<IExperimentsService, IExperimentsServiceConfig>;
|
|
13
|
+
export declare const ExperimentsDefinition: string & {
|
|
14
|
+
__api: IExperimentsService;
|
|
15
|
+
__config: IExperimentsServiceConfig;
|
|
16
|
+
isServiceDefinition?: boolean;
|
|
17
|
+
} & IExperimentsService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAkBzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAC9C,+BAA+B,CAClC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExperimentsService, IExperimentsServiceConfig } from '../definition';
|
|
2
|
+
export declare const ExperimentsService: import("@wix/services-definitions").ServiceFactory<string & {
|
|
3
|
+
__api: IExperimentsService;
|
|
4
|
+
__config: IExperimentsServiceConfig;
|
|
5
|
+
isServiceDefinition?: boolean;
|
|
6
|
+
} & IExperimentsService, IExperimentsServiceConfig>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { implementService } from '@wix/services-definitions';
|
|
2
|
+
import { ExperimentsDefinition } from '../definition';
|
|
3
|
+
export const ExperimentsService = implementService(ExperimentsDefinition, ({ config }) => {
|
|
4
|
+
const _experiments = config.experiments ?? {};
|
|
5
|
+
return {
|
|
6
|
+
get all() {
|
|
7
|
+
return _experiments;
|
|
8
|
+
},
|
|
9
|
+
isOpen(name) {
|
|
10
|
+
const value = _experiments[name];
|
|
11
|
+
return value === true || value === 'true' || value === 'B';
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=experimentsService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experimentsService.js","sourceRoot":"","sources":["../../src/implementations/experimentsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAC9C,qBAAqB,EACrB,CAAC,EAAE,MAAM,EAAiD,EAAuB,EAAE;IAC/E,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE,CAAA;IAE7C,OAAO;QACH,IAAI,GAAG;YACH,OAAO,YAAY,CAAA;QACvB,CAAC;QACD,MAAM,CAAC,IAAY;YACf,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;YAChC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAA;QAC9D,CAAC;KACJ,CAAA;AACL,CAAC,CACJ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './experimentsService';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/implementations/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExperimentsService } from './implementations/experimentsService';
|
|
2
|
+
export declare const definition: string & {
|
|
3
|
+
__api: import("./definition").IExperimentsService;
|
|
4
|
+
__config: import("./definition").IExperimentsServiceConfig;
|
|
5
|
+
isServiceDefinition?: boolean;
|
|
6
|
+
} & import("./definition").IExperimentsService;
|
|
7
|
+
export default ExperimentsService;
|
package/dist/service.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AAEzE,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,CAAA;AAC/C,eAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IExperimentsService, IExperimentsServiceConfig, IExperimentsDefinition } from '../definition';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wix/site-service-experiments",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"main": "cjs/build/index.js",
|
|
5
|
+
"module": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src",
|
|
11
|
+
"cjs",
|
|
12
|
+
"definition",
|
|
13
|
+
"implementations",
|
|
14
|
+
"types",
|
|
15
|
+
"!**/*.tsbuildinfo",
|
|
16
|
+
"!doc.md"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./cjs/build/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./definition": {
|
|
25
|
+
"types": "./dist/definition/index.d.ts",
|
|
26
|
+
"import": "./dist/definition/index.js",
|
|
27
|
+
"require": "./cjs/build/definition/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./implementations": {
|
|
30
|
+
"types": "./dist/implementations/index.d.ts",
|
|
31
|
+
"import": "./dist/implementations/index.js",
|
|
32
|
+
"require": "./cjs/build/implementations/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./types": {
|
|
35
|
+
"types": "./dist/types/index.d.ts",
|
|
36
|
+
"import": "./dist/types/index.js",
|
|
37
|
+
"require": "./cjs/build/types/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./service": {
|
|
40
|
+
"types": "./dist/service.d.ts",
|
|
41
|
+
"import": "./dist/service.js",
|
|
42
|
+
"require": "./cjs/build/service.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@wix/services-definitions": "^0.1.4",
|
|
47
|
+
"@wix/services-manager": "^0.2.20"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"typescript": "^5.3.3",
|
|
51
|
+
"vitest": "4.1.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc -b . --force && tsc --project tsconfig.cjs.json",
|
|
55
|
+
"lint": "yarn run -T lint:package $npm_package_name",
|
|
56
|
+
"test": "vitest --run && yarn test-type-check",
|
|
57
|
+
"test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
|
|
58
|
+
},
|
|
59
|
+
"publishUnscoped": false,
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"registry": "https://registry.npmjs.org/",
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"sideEffects": false,
|
|
65
|
+
"wix": {
|
|
66
|
+
"artifact": {
|
|
67
|
+
"groupId": "com.wixpress.npm",
|
|
68
|
+
"artifactId": "site-service-experiments",
|
|
69
|
+
"targets": {
|
|
70
|
+
"static": false,
|
|
71
|
+
"docker": false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"validations": {
|
|
75
|
+
"postBuild": [
|
|
76
|
+
"test",
|
|
77
|
+
"lint"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"falconPackageHash": "89d8310409f1649a49108f695675c6127b5046dc06393b54abbe4714"
|
|
82
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineService } from '@wix/services-definitions'
|
|
2
|
+
import type { ServiceDefinition } from '@wix/services-definitions'
|
|
3
|
+
|
|
4
|
+
export type Experiments = {
|
|
5
|
+
[experimentName: string]: string | boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type IExperimentsServiceConfig = {
|
|
9
|
+
experiments?: Experiments
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IExperimentsService {
|
|
13
|
+
readonly all: Experiments
|
|
14
|
+
isOpen(name: string): boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type IExperimentsDefinition = ServiceDefinition<IExperimentsService, IExperimentsServiceConfig>
|
|
18
|
+
|
|
19
|
+
export const ExperimentsDefinition = defineService<IExperimentsService, IExperimentsServiceConfig>(
|
|
20
|
+
'@wix/site-service-experiments'
|
|
21
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { implementService } from '@wix/services-definitions'
|
|
2
|
+
import type { ServiceFactoryOpts } from '@wix/services-definitions'
|
|
3
|
+
import type { IExperimentsService, IExperimentsServiceConfig } from '../definition'
|
|
4
|
+
import { ExperimentsDefinition } from '../definition'
|
|
5
|
+
|
|
6
|
+
export const ExperimentsService = implementService(
|
|
7
|
+
ExperimentsDefinition,
|
|
8
|
+
({ config }: ServiceFactoryOpts<IExperimentsServiceConfig>): IExperimentsService => {
|
|
9
|
+
const _experiments = config.experiments ?? {}
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
get all() {
|
|
13
|
+
return _experiments
|
|
14
|
+
},
|
|
15
|
+
isOpen(name: string) {
|
|
16
|
+
const value = _experiments[name]
|
|
17
|
+
return value === true || value === 'true' || value === 'B'
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './experimentsService'
|
package/src/index.ts
ADDED
package/src/service.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IExperimentsService, IExperimentsServiceConfig, IExperimentsDefinition } from '../definition'
|