@wix/essentials 0.1.22 → 0.1.24
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/build/auth.d.ts +1 -0
- package/build/auth.js +1 -0
- package/build/error-handler.d.ts +1 -1
- package/build/experiments.js +8 -20
- package/cjs/build/auth.d.ts +1 -0
- package/cjs/build/auth.js +3 -1
- package/cjs/build/error-handler.d.ts +1 -1
- package/cjs/build/experiments.js +8 -20
- package/internal/build/auth.d.ts +1 -0
- package/internal/build/auth.js +3 -1
- package/internal/build/error-handler.d.ts +1 -1
- package/internal/build/experiments.d.ts +4 -8
- package/internal/build/experiments.js +8 -20
- package/internal/cjs/build/auth.d.ts +1 -0
- package/internal/cjs/build/auth.js +1 -0
- package/internal/cjs/build/error-handler.d.ts +1 -1
- package/internal/cjs/build/experiments.d.ts +4 -8
- package/internal/cjs/build/experiments.js +8 -20
- package/package.json +5 -5
package/build/auth.d.ts
CHANGED
package/build/auth.js
CHANGED
package/build/error-handler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedError, ErrorCodesMap, ErrorHandler } from '@wix/sdk-types';
|
|
2
|
-
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap) => Promise<T>;
|
|
2
|
+
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap, options?: import("@wix/error-handler-types/dist/types/v2/ErrorHandlerPublicAPI.js").WithErrorHandlerOptions) => Promise<T>;
|
|
3
3
|
export declare const getResolvedError: <T>(error: unknown) => ResolvedError & Partial<T>;
|
|
4
4
|
export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2/ShowError.js").ShowErrorOverrideProps> | null) => void;
|
|
5
5
|
export type { ErrorHandler, ResolvedError, ErrorCodesMap };
|
package/build/experiments.js
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { createHostModule } from '@wix/sdk-runtime/host-modules';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export const experiments = createHostModule({
|
|
4
|
-
|
|
5
|
-
if (!host.
|
|
6
|
-
throw new Error('Host "
|
|
4
|
+
enabled: (host) => (key) => {
|
|
5
|
+
if (!host.getExperiments) {
|
|
6
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
7
7
|
}
|
|
8
|
-
return host.
|
|
8
|
+
return host.getExperiments().enabled(key);
|
|
9
9
|
},
|
|
10
|
-
|
|
11
|
-
if (!host.
|
|
12
|
-
throw new Error('Host "
|
|
10
|
+
get: (host) => (key) => {
|
|
11
|
+
if (!host.getExperiments) {
|
|
12
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
13
13
|
}
|
|
14
|
-
return host.
|
|
15
|
-
},
|
|
16
|
-
isFeatureOn: (host) => (featureName) => {
|
|
17
|
-
if (!host.getConductorClient) {
|
|
18
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
19
|
-
}
|
|
20
|
-
return host.getConductorClient().isFeatureOn(featureName);
|
|
21
|
-
},
|
|
22
|
-
getABTestVariant: (host) => (abTestName) => {
|
|
23
|
-
if (!host.getConductorClient) {
|
|
24
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
25
|
-
}
|
|
26
|
-
return host.getConductorClient().getABTestVariant(abTestName);
|
|
14
|
+
return host.getExperiments().get(key);
|
|
27
15
|
},
|
|
28
16
|
});
|
package/cjs/build/auth.d.ts
CHANGED
package/cjs/build/auth.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokenInfo = void 0;
|
|
3
|
+
exports.getTokenInfo = exports.getContextualAuth = void 0;
|
|
4
4
|
exports.elevate = elevate;
|
|
5
5
|
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
6
|
+
var context_1 = require("@wix/sdk-runtime/context");
|
|
7
|
+
Object.defineProperty(exports, "getContextualAuth", { enumerable: true, get: function () { return context_1.getContextualAuth; } });
|
|
6
8
|
function elevate(restModule) {
|
|
7
9
|
return (0, rest_modules_1.createRESTModule)(restModule, true);
|
|
8
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedError, ErrorCodesMap, ErrorHandler } from '@wix/sdk-types';
|
|
2
|
-
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap) => Promise<T>;
|
|
2
|
+
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap, options?: import("@wix/error-handler-types/dist/types/v2").WithErrorHandlerOptions) => Promise<T>;
|
|
3
3
|
export declare const getResolvedError: <T>(error: unknown) => ResolvedError & Partial<T>;
|
|
4
4
|
export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2").ShowErrorOverrideProps> | null) => void;
|
|
5
5
|
export type { ErrorHandler, ResolvedError, ErrorCodesMap };
|
package/cjs/build/experiments.js
CHANGED
|
@@ -4,28 +4,16 @@ exports.experiments = void 0;
|
|
|
4
4
|
const host_modules_1 = require("@wix/sdk-runtime/host-modules");
|
|
5
5
|
/** @internal */
|
|
6
6
|
exports.experiments = (0, host_modules_1.createHostModule)({
|
|
7
|
-
|
|
8
|
-
if (!host.
|
|
9
|
-
throw new Error('Host "
|
|
7
|
+
enabled: (host) => (key) => {
|
|
8
|
+
if (!host.getExperiments) {
|
|
9
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
10
10
|
}
|
|
11
|
-
return host.
|
|
11
|
+
return host.getExperiments().enabled(key);
|
|
12
12
|
},
|
|
13
|
-
|
|
14
|
-
if (!host.
|
|
15
|
-
throw new Error('Host "
|
|
13
|
+
get: (host) => (key) => {
|
|
14
|
+
if (!host.getExperiments) {
|
|
15
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
16
16
|
}
|
|
17
|
-
return host.
|
|
18
|
-
},
|
|
19
|
-
isFeatureOn: (host) => (featureName) => {
|
|
20
|
-
if (!host.getConductorClient) {
|
|
21
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
22
|
-
}
|
|
23
|
-
return host.getConductorClient().isFeatureOn(featureName);
|
|
24
|
-
},
|
|
25
|
-
getABTestVariant: (host) => (abTestName) => {
|
|
26
|
-
if (!host.getConductorClient) {
|
|
27
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
28
|
-
}
|
|
29
|
-
return host.getConductorClient().getABTestVariant(abTestName);
|
|
17
|
+
return host.getExperiments().get(key);
|
|
30
18
|
},
|
|
31
19
|
});
|
package/internal/build/auth.d.ts
CHANGED
package/internal/build/auth.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokenInfo = void 0;
|
|
3
|
+
exports.getTokenInfo = exports.getContextualAuth = void 0;
|
|
4
4
|
exports.elevate = elevate;
|
|
5
5
|
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
6
|
+
var context_1 = require("@wix/sdk-runtime/context");
|
|
7
|
+
Object.defineProperty(exports, "getContextualAuth", { enumerable: true, get: function () { return context_1.getContextualAuth; } });
|
|
6
8
|
function elevate(restModule) {
|
|
7
9
|
return (0, rest_modules_1.createRESTModule)(restModule, true);
|
|
8
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedError, ErrorCodesMap, ErrorHandler } from '@wix/sdk-types';
|
|
2
|
-
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap) => Promise<T>;
|
|
2
|
+
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap, options?: import("@wix/error-handler-types/dist/types/v2").WithErrorHandlerOptions) => Promise<T>;
|
|
3
3
|
export declare const getResolvedError: <T>(error: unknown) => ResolvedError & Partial<T>;
|
|
4
4
|
export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2").ShowErrorOverrideProps> | null) => void;
|
|
5
5
|
/** @internal */
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/** @internal */
|
|
2
2
|
export declare const experiments: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isFeatureOn: (featureName: string) => boolean;
|
|
6
|
-
getABTestVariant: (abTestName: string) => "a" | "b" | "c" | "d" | "e";
|
|
3
|
+
enabled: (key: string) => boolean;
|
|
4
|
+
get: (key: string) => any;
|
|
7
5
|
} & import("@wix/sdk-types").HostModule<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
isFeatureOn: (featureName: string) => boolean;
|
|
11
|
-
getABTestVariant: (abTestName: string) => "a" | "b" | "c" | "d" | "e";
|
|
6
|
+
enabled: (key: string) => boolean;
|
|
7
|
+
get: (key: string) => any;
|
|
12
8
|
}, import("@wix/sdk-types").Host>;
|
|
@@ -4,28 +4,16 @@ exports.experiments = void 0;
|
|
|
4
4
|
const host_modules_1 = require("@wix/sdk-runtime/host-modules");
|
|
5
5
|
/** @internal */
|
|
6
6
|
exports.experiments = (0, host_modules_1.createHostModule)({
|
|
7
|
-
|
|
8
|
-
if (!host.
|
|
9
|
-
throw new Error('Host "
|
|
7
|
+
enabled: (host) => (key) => {
|
|
8
|
+
if (!host.getExperiments) {
|
|
9
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
10
10
|
}
|
|
11
|
-
return host.
|
|
11
|
+
return host.getExperiments().enabled(key);
|
|
12
12
|
},
|
|
13
|
-
|
|
14
|
-
if (!host.
|
|
15
|
-
throw new Error('Host "
|
|
13
|
+
get: (host) => (key) => {
|
|
14
|
+
if (!host.getExperiments) {
|
|
15
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
16
16
|
}
|
|
17
|
-
return host.
|
|
18
|
-
},
|
|
19
|
-
isFeatureOn: (host) => (featureName) => {
|
|
20
|
-
if (!host.getConductorClient) {
|
|
21
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
22
|
-
}
|
|
23
|
-
return host.getConductorClient().isFeatureOn(featureName);
|
|
24
|
-
},
|
|
25
|
-
getABTestVariant: (host) => (abTestName) => {
|
|
26
|
-
if (!host.getConductorClient) {
|
|
27
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
28
|
-
}
|
|
29
|
-
return host.getConductorClient().getABTestVariant(abTestName);
|
|
17
|
+
return host.getExperiments().get(key);
|
|
30
18
|
},
|
|
31
19
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedError, ErrorCodesMap, ErrorHandler } from '@wix/sdk-types';
|
|
2
|
-
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap) => Promise<T>;
|
|
2
|
+
export declare const withErrorHandler: <T>(fn: () => Promise<T>, errorCodesMap: ErrorCodesMap, options?: import("@wix/error-handler-types/dist/types/v2/ErrorHandlerPublicAPI.js").WithErrorHandlerOptions) => Promise<T>;
|
|
3
3
|
export declare const getResolvedError: <T>(error: unknown) => ResolvedError & Partial<T>;
|
|
4
4
|
export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2/ShowError.js").ShowErrorOverrideProps> | null) => void;
|
|
5
5
|
/** @internal */
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/** @internal */
|
|
2
2
|
export declare const experiments: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isFeatureOn: (featureName: string) => boolean;
|
|
6
|
-
getABTestVariant: (abTestName: string) => "a" | "b" | "c" | "d" | "e";
|
|
3
|
+
enabled: (key: string) => boolean;
|
|
4
|
+
get: (key: string) => any;
|
|
7
5
|
} & import("@wix/sdk-types").HostModule<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
isFeatureOn: (featureName: string) => boolean;
|
|
11
|
-
getABTestVariant: (abTestName: string) => "a" | "b" | "c" | "d" | "e";
|
|
6
|
+
enabled: (key: string) => boolean;
|
|
7
|
+
get: (key: string) => any;
|
|
12
8
|
}, import("@wix/sdk-types").Host>;
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { createHostModule } from '@wix/sdk-runtime/host-modules';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export const experiments = createHostModule({
|
|
4
|
-
|
|
5
|
-
if (!host.
|
|
6
|
-
throw new Error('Host "
|
|
4
|
+
enabled: (host) => (key) => {
|
|
5
|
+
if (!host.getExperiments) {
|
|
6
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
7
7
|
}
|
|
8
|
-
return host.
|
|
8
|
+
return host.getExperiments().enabled(key);
|
|
9
9
|
},
|
|
10
|
-
|
|
11
|
-
if (!host.
|
|
12
|
-
throw new Error('Host "
|
|
10
|
+
get: (host) => (key) => {
|
|
11
|
+
if (!host.getExperiments) {
|
|
12
|
+
throw new Error('Host "Experiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
13
13
|
}
|
|
14
|
-
return host.
|
|
15
|
-
},
|
|
16
|
-
isFeatureOn: (host) => (featureName) => {
|
|
17
|
-
if (!host.getConductorClient) {
|
|
18
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
19
|
-
}
|
|
20
|
-
return host.getConductorClient().isFeatureOn(featureName);
|
|
21
|
-
},
|
|
22
|
-
getABTestVariant: (host) => (abTestName) => {
|
|
23
|
-
if (!host.getConductorClient) {
|
|
24
|
-
throw new Error('Host conductor client is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
|
|
25
|
-
}
|
|
26
|
-
return host.getConductorClient().getABTestVariant(abTestName);
|
|
14
|
+
return host.getExperiments().get(key);
|
|
27
15
|
},
|
|
28
16
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/essentials",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "cjs/build/index.js",
|
|
6
6
|
"module": "build/index.mjs",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@wix/monitoring": "^0.21.0",
|
|
40
|
-
"@wix/sdk-runtime": "^0.3.
|
|
41
|
-
"@wix/sdk-types": "^1.13.
|
|
40
|
+
"@wix/sdk-runtime": "^0.3.55",
|
|
41
|
+
"@wix/sdk-types": "^1.13.31"
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
44
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/is-ci": "^3.0.4",
|
|
48
48
|
"@types/node": "^20.19.0",
|
|
49
49
|
"@vitest/ui": "^1.6.1",
|
|
50
|
-
"@wix/sdk": "1.15.
|
|
50
|
+
"@wix/sdk": "1.15.23",
|
|
51
51
|
"eslint": "^8.57.1",
|
|
52
52
|
"eslint-config-sdk": "0.0.0",
|
|
53
53
|
"graphql": "^16.8.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"falconPackageHash": "
|
|
78
|
+
"falconPackageHash": "928676d6dc65d0a4dd1f8968edf085099d67c2c21f435bfbfeccf8c8"
|
|
79
79
|
}
|