@wix/essentials 0.1.21 → 0.1.23

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
- export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2/ShowError.js").ShowErrorProps> | null) => void;
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/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export { i18n } from './i18n.js';
6
6
  export { monitoring } from './monitoring.js';
7
7
  export { bi } from './bi.js';
8
8
  export { experiments } from './experiments.js';
9
+ export { settings } from './settings.js';
package/build/index.js CHANGED
@@ -6,3 +6,4 @@ export { i18n } from './i18n.js';
6
6
  export { monitoring } from './monitoring.js';
7
7
  export { bi } from './bi.js';
8
8
  export { experiments } from './experiments.js';
9
+ export { settings } from './settings.js';
@@ -0,0 +1,5 @@
1
+ export declare const settings: {
2
+ getTimezone: () => string;
3
+ } & import("@wix/sdk-types").HostModule<{
4
+ getTimezone: () => string;
5
+ }, import("@wix/sdk-types").Host>;
@@ -0,0 +1,10 @@
1
+ import { createHostModule } from '@wix/sdk-runtime/host-modules';
2
+ export const settings = createHostModule({
3
+ getTimezone: (host) => () => {
4
+ const timezone = host.essentials?.timezone;
5
+ if (!timezone) {
6
+ throw new Error('Host timezone is not available on the current host. Make sure to use an updated version of the host initialization package.');
7
+ }
8
+ return timezone;
9
+ },
10
+ });
@@ -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
- export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2").ShowErrorProps> | null) => void;
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 };
@@ -6,3 +6,4 @@ export { i18n } from './i18n.js';
6
6
  export { monitoring } from './monitoring.js';
7
7
  export { bi } from './bi.js';
8
8
  export { experiments } from './experiments.js';
9
+ export { settings } from './settings.js';
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.experiments = exports.bi = exports.monitoring = exports.i18n = exports.errorHandler = exports.httpClient = exports.auth = void 0;
36
+ exports.settings = exports.experiments = exports.bi = exports.monitoring = exports.i18n = exports.errorHandler = exports.httpClient = exports.auth = void 0;
37
37
  const auth = __importStar(require("./auth.js"));
38
38
  exports.auth = auth;
39
39
  const httpClient = __importStar(require("./http-client.js"));
@@ -48,3 +48,5 @@ var bi_js_1 = require("./bi.js");
48
48
  Object.defineProperty(exports, "bi", { enumerable: true, get: function () { return bi_js_1.bi; } });
49
49
  var experiments_js_1 = require("./experiments.js");
50
50
  Object.defineProperty(exports, "experiments", { enumerable: true, get: function () { return experiments_js_1.experiments; } });
51
+ var settings_js_1 = require("./settings.js");
52
+ Object.defineProperty(exports, "settings", { enumerable: true, get: function () { return settings_js_1.settings; } });
@@ -0,0 +1,5 @@
1
+ export declare const settings: {
2
+ getTimezone: () => string;
3
+ } & import("@wix/sdk-types").HostModule<{
4
+ getTimezone: () => string;
5
+ }, import("@wix/sdk-types").Host>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.settings = void 0;
4
+ const host_modules_1 = require("@wix/sdk-runtime/host-modules");
5
+ exports.settings = (0, host_modules_1.createHostModule)({
6
+ getTimezone: (host) => () => {
7
+ const timezone = host.essentials?.timezone;
8
+ if (!timezone) {
9
+ throw new Error('Host timezone is not available on the current host. Make sure to use an updated version of the host initialization package.');
10
+ }
11
+ return timezone;
12
+ },
13
+ });
@@ -1 +1 @@
1
- {"root":["../src/auth.ts","../src/bi.ts","../src/error-handler.ts","../src/experiments.ts","../src/http-client.ts","../src/i18n.ts","../src/index.ts","../src/monitoring.ts"],"version":"5.8.3"}
1
+ {"root":["../src/auth.ts","../src/bi.ts","../src/error-handler.ts","../src/experiments.ts","../src/http-client.ts","../src/i18n.ts","../src/index.ts","../src/monitoring.ts","../src/settings.ts"],"version":"5.8.3"}
@@ -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,7 +1,7 @@
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
- export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2").ShowErrorProps> | null) => void;
4
+ export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2").ShowErrorOverrideProps> | null) => void;
5
5
  /** @internal */
6
6
  export declare const reportRetryAttempt: (error: unknown) => void;
7
7
  export type { ErrorHandler, ResolvedError, ErrorCodesMap };
@@ -6,3 +6,4 @@ export { i18n } from './i18n.js';
6
6
  export { monitoring } from './monitoring.js';
7
7
  export { bi } from './bi.js';
8
8
  export { experiments } from './experiments.js';
9
+ export { settings } from './settings.js';
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.experiments = exports.bi = exports.monitoring = exports.i18n = exports.errorHandler = exports.httpClient = exports.auth = void 0;
36
+ exports.settings = exports.experiments = exports.bi = exports.monitoring = exports.i18n = exports.errorHandler = exports.httpClient = exports.auth = void 0;
37
37
  const auth = __importStar(require("./auth.js"));
38
38
  exports.auth = auth;
39
39
  const httpClient = __importStar(require("./http-client.js"));
@@ -48,3 +48,5 @@ var bi_js_1 = require("./bi.js");
48
48
  Object.defineProperty(exports, "bi", { enumerable: true, get: function () { return bi_js_1.bi; } });
49
49
  var experiments_js_1 = require("./experiments.js");
50
50
  Object.defineProperty(exports, "experiments", { enumerable: true, get: function () { return experiments_js_1.experiments; } });
51
+ var settings_js_1 = require("./settings.js");
52
+ Object.defineProperty(exports, "settings", { enumerable: true, get: function () { return settings_js_1.settings; } });
@@ -0,0 +1,5 @@
1
+ export declare const settings: {
2
+ getTimezone: () => string;
3
+ } & import("@wix/sdk-types").HostModule<{
4
+ getTimezone: () => string;
5
+ }, import("@wix/sdk-types").Host>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.settings = void 0;
4
+ const host_modules_1 = require("@wix/sdk-runtime/host-modules");
5
+ exports.settings = (0, host_modules_1.createHostModule)({
6
+ getTimezone: (host) => () => {
7
+ const timezone = host.essentials?.timezone;
8
+ if (!timezone) {
9
+ throw new Error('Host timezone is not available on the current host. Make sure to use an updated version of the host initialization package.');
10
+ }
11
+ return timezone;
12
+ },
13
+ });
@@ -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,7 +1,7 @@
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
- export declare const showError: (error: unknown, props?: Partial<import("@wix/error-handler-types/dist/types/v2/ShowError.js").ShowErrorProps> | null) => void;
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 */
6
6
  export declare const reportRetryAttempt: (error: unknown) => void;
7
7
  export type { ErrorHandler, ResolvedError, ErrorCodesMap };
@@ -6,3 +6,4 @@ export { i18n } from './i18n.js';
6
6
  export { monitoring } from './monitoring.js';
7
7
  export { bi } from './bi.js';
8
8
  export { experiments } from './experiments.js';
9
+ export { settings } from './settings.js';
@@ -6,3 +6,4 @@ export { i18n } from './i18n.js';
6
6
  export { monitoring } from './monitoring.js';
7
7
  export { bi } from './bi.js';
8
8
  export { experiments } from './experiments.js';
9
+ export { settings } from './settings.js';
@@ -0,0 +1,5 @@
1
+ export declare const settings: {
2
+ getTimezone: () => string;
3
+ } & import("@wix/sdk-types").HostModule<{
4
+ getTimezone: () => string;
5
+ }, import("@wix/sdk-types").Host>;
@@ -0,0 +1,10 @@
1
+ import { createHostModule } from '@wix/sdk-runtime/host-modules';
2
+ export const settings = createHostModule({
3
+ getTimezone: (host) => () => {
4
+ const timezone = host.essentials?.timezone;
5
+ if (!timezone) {
6
+ throw new Error('Host timezone is not available on the current host. Make sure to use an updated version of the host initialization package.');
7
+ }
8
+ return timezone;
9
+ },
10
+ });
@@ -1 +1 @@
1
- {"root":["../../src/auth.ts","../../src/bi.ts","../../src/error-handler.ts","../../src/experiments.ts","../../src/http-client.ts","../../src/i18n.ts","../../src/index.ts","../../src/monitoring.ts"],"version":"5.8.3"}
1
+ {"root":["../../src/auth.ts","../../src/bi.ts","../../src/error-handler.ts","../../src/experiments.ts","../../src/http-client.ts","../../src/i18n.ts","../../src/index.ts","../../src/monitoring.ts","../../src/settings.ts"],"version":"5.8.3"}
@@ -1 +1 @@
1
- {"root":["../src/auth.ts","../src/bi.ts","../src/error-handler.ts","../src/experiments.ts","../src/http-client.ts","../src/i18n.ts","../src/index.ts","../src/monitoring.ts"],"version":"5.8.3"}
1
+ {"root":["../src/auth.ts","../src/bi.ts","../src/error-handler.ts","../src/experiments.ts","../src/http-client.ts","../src/i18n.ts","../src/index.ts","../src/monitoring.ts","../src/settings.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/essentials",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "license": "MIT",
5
5
  "main": "cjs/build/index.js",
6
6
  "module": "build/index.mjs",
@@ -37,15 +37,15 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@wix/monitoring": "^0.21.0",
40
- "@wix/sdk-runtime": "^0.3.52",
41
- "@wix/sdk-types": "^1.13.25"
40
+ "@wix/sdk-runtime": "^0.3.54",
41
+ "@wix/sdk-types": "^1.13.30"
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"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/is-ci": "^3.0.4",
48
- "@types/node": "^20.17.47",
48
+ "@types/node": "^20.19.0",
49
49
  "@vitest/ui": "^1.6.1",
50
50
  "@wix/sdk": "1.15.22",
51
51
  "eslint": "^8.57.1",
@@ -53,7 +53,7 @@
53
53
  "graphql": "^16.8.0",
54
54
  "is-ci": "^3.0.1",
55
55
  "jsdom": "^22.1.0",
56
- "msw": "^2.8.3",
56
+ "msw": "^2.10.0",
57
57
  "typescript": "^5.8.3",
58
58
  "vitest": "^1.6.1",
59
59
  "vitest-teamcity-reporter": "^0.3.1"
@@ -75,5 +75,5 @@
75
75
  ]
76
76
  }
77
77
  },
78
- "falconPackageHash": "acf8fdc9a191264c4e3c35fe2f1770f1722dffc7057ea2dd52c0380f"
78
+ "falconPackageHash": "c79df9657bf71082b10cbfaeae9a67cafec69e4fc5718f45af311de1"
79
79
  }