@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 CHANGED
@@ -1,3 +1,4 @@
1
+ export { getContextualAuth } from '@wix/sdk-runtime/context';
1
2
  export declare function elevate<T>(restModule: T): T;
2
3
  /**
3
4
  * Returns the information encoded in the currently active token in API backend extensions.
package/build/auth.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
2
+ export { getContextualAuth } from '@wix/sdk-runtime/context';
2
3
  export function elevate(restModule) {
3
4
  return createRESTModule(restModule, true);
4
5
  }
@@ -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 };
@@ -1,28 +1,16 @@
1
1
  import { createHostModule } from '@wix/sdk-runtime/host-modules';
2
2
  /** @internal */
3
3
  export const experiments = createHostModule({
4
- isEnabled_legacy: (host) => (specName) => {
5
- if (!host.getPetriExperimentsClient) {
6
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().enabled(specName);
8
+ return host.getExperiments().enabled(key);
9
9
  },
10
- getValue_legacy: (host) => (specName) => {
11
- if (!host.getPetriExperimentsClient) {
12
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().get(specName);
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
  });
@@ -1,3 +1,4 @@
1
+ export { getContextualAuth } from '@wix/sdk-runtime/context';
1
2
  export declare function elevate<T>(restModule: T): T;
2
3
  /**
3
4
  * Returns the information encoded in the currently active token in API backend extensions.
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 };
@@ -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
- isEnabled_legacy: (host) => (specName) => {
8
- if (!host.getPetriExperimentsClient) {
9
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().enabled(specName);
11
+ return host.getExperiments().enabled(key);
12
12
  },
13
- getValue_legacy: (host) => (specName) => {
14
- if (!host.getPetriExperimentsClient) {
15
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().get(specName);
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,3 +1,4 @@
1
+ export { getContextualAuth } from '@wix/sdk-runtime/context';
1
2
  export declare function elevate<T>(restModule: T): T;
2
3
  /**
3
4
  * Returns the information encoded in the currently active token in API backend extensions.
@@ -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
- isEnabled_legacy: (specName: string) => boolean;
4
- getValue_legacy: (specName: string) => any;
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
- isEnabled_legacy: (specName: string) => boolean;
9
- getValue_legacy: (specName: string) => any;
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
- isEnabled_legacy: (host) => (specName) => {
8
- if (!host.getPetriExperimentsClient) {
9
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().enabled(specName);
11
+ return host.getExperiments().enabled(key);
12
12
  },
13
- getValue_legacy: (host) => (specName) => {
14
- if (!host.getPetriExperimentsClient) {
15
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().get(specName);
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,3 +1,4 @@
1
+ export { getContextualAuth } from '@wix/sdk-runtime/context';
1
2
  export declare function elevate<T>(restModule: T): T;
2
3
  /**
3
4
  * Returns the information encoded in the currently active token in API backend extensions.
@@ -1,4 +1,5 @@
1
1
  import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
2
+ export { getContextualAuth } from '@wix/sdk-runtime/context';
2
3
  export function elevate(restModule) {
3
4
  return createRESTModule(restModule, true);
4
5
  }
@@ -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
- isEnabled_legacy: (specName: string) => boolean;
4
- getValue_legacy: (specName: string) => any;
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
- isEnabled_legacy: (specName: string) => boolean;
9
- getValue_legacy: (specName: string) => any;
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
- isEnabled_legacy: (host) => (specName) => {
5
- if (!host.getPetriExperimentsClient) {
6
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().enabled(specName);
8
+ return host.getExperiments().enabled(key);
9
9
  },
10
- getValue_legacy: (host) => (specName) => {
11
- if (!host.getPetriExperimentsClient) {
12
- throw new Error('Host "PetriExperiments" are not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
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.getPetriExperimentsClient().get(specName);
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.22",
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.53",
41
- "@wix/sdk-types": "^1.13.29"
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.22",
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": "3ed427211afae0adbd6f811bb4264582b75c5314fdf2069639406af9"
78
+ "falconPackageHash": "928676d6dc65d0a4dd1f8968edf085099d67c2c21f435bfbfeccf8c8"
79
79
  }