@wix/essentials 0.1.3 → 0.1.4

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.
@@ -0,0 +1,7 @@
1
+ export declare const i18n: {
2
+ getLanguage: () => string;
3
+ getLocale: () => string;
4
+ } & import("@wix/sdk-types").HostModule<{
5
+ getLanguage: () => string;
6
+ getLocale: () => string;
7
+ }, import("@wix/sdk-types").Host>;
package/build/i18n.js ADDED
@@ -0,0 +1,17 @@
1
+ import { createHostModule } from '@wix/sdk-runtime/host-modules';
2
+ export const i18n = createHostModule({
3
+ getLanguage: (host) => () => {
4
+ const language = host.essentials?.language;
5
+ if (!language) {
6
+ throw new Error('Host language is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
7
+ }
8
+ return language;
9
+ },
10
+ getLocale: (host) => () => {
11
+ const locale = host.essentials?.locale;
12
+ if (!locale) {
13
+ throw new Error('Host locale is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
14
+ }
15
+ return locale;
16
+ },
17
+ });
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as httpClient from './http-client.js';
3
3
  export { auth, httpClient };
4
+ export { i18n } from './i18n.js';
package/build/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as httpClient from './http-client.js';
3
3
  export { auth, httpClient };
4
+ export { i18n } from './i18n.js';
@@ -0,0 +1,7 @@
1
+ export declare const i18n: {
2
+ getLanguage: () => string;
3
+ getLocale: () => string;
4
+ } & import("@wix/sdk-types").HostModule<{
5
+ getLanguage: () => string;
6
+ getLocale: () => string;
7
+ }, import("@wix/sdk-types").Host>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.i18n = void 0;
4
+ const host_modules_1 = require("@wix/sdk-runtime/host-modules");
5
+ exports.i18n = (0, host_modules_1.createHostModule)({
6
+ getLanguage: (host) => () => {
7
+ const language = host.essentials?.language;
8
+ if (!language) {
9
+ throw new Error('Host language is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
10
+ }
11
+ return language;
12
+ },
13
+ getLocale: (host) => () => {
14
+ const locale = host.essentials?.locale;
15
+ if (!locale) {
16
+ throw new Error('Host locale is not available on the current host. Make sure to use an updated version of the host initialization pacakge.');
17
+ }
18
+ return locale;
19
+ },
20
+ });
@@ -1,3 +1,4 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as httpClient from './http-client.js';
3
3
  export { auth, httpClient };
4
+ export { i18n } from './i18n.js';
@@ -23,8 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.httpClient = exports.auth = void 0;
26
+ exports.i18n = exports.httpClient = exports.auth = void 0;
27
27
  const auth = __importStar(require("./auth.js"));
28
28
  exports.auth = auth;
29
29
  const httpClient = __importStar(require("./http-client.js"));
30
30
  exports.httpClient = httpClient;
31
+ var i18n_js_1 = require("./i18n.js");
32
+ Object.defineProperty(exports, "i18n", { enumerable: true, get: function () { return i18n_js_1.i18n; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/essentials",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "UNLICENSED",
5
5
  "main": "cjs/build/index.js",
6
6
  "module": "build/index.mjs",
@@ -31,8 +31,8 @@
31
31
  "*.{js,ts}": "yarn lint"
32
32
  },
33
33
  "dependencies": {
34
- "@wix/sdk-runtime": "^0.3.16",
35
- "@wix/sdk-types": "^1.9.3"
34
+ "@wix/sdk-runtime": "^0.3.17",
35
+ "@wix/sdk-types": "^1.10.0"
36
36
  },
37
37
  "optionalDependencies": {
38
38
  "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"
@@ -41,7 +41,7 @@
41
41
  "@types/is-ci": "^3.0.4",
42
42
  "@types/node": "^20.10.6",
43
43
  "@vitest/ui": "^1.5.0",
44
- "@wix/sdk-runtime": "0.3.16",
44
+ "@wix/sdk-runtime": "0.3.17",
45
45
  "eslint": "^8.56.0",
46
46
  "eslint-config-sdk": "0.0.0",
47
47
  "graphql": "^16.8.0",
@@ -69,5 +69,5 @@
69
69
  ]
70
70
  }
71
71
  },
72
- "falconPackageHash": "8270bdaea615296af6217918c47c7219fbee96ba04c820f762a0ac29"
72
+ "falconPackageHash": "afe157abb030ac5b0c147efaf2957e520b3b7f5aa49be3305c4bb5c5"
73
73
  }