@prezly/theme-kit-core 10.5.0 → 10.5.2

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.
@@ -184,7 +184,7 @@ function createClient(prezly, newsroomUuid, newsroomThemeUuid) {
184
184
  offset: offset > 0 ? offset + highlighted : offset,
185
185
  search,
186
186
  query: mergeQueries(query, {
187
- ["category.id"]: categories !== null && categories !== void 0 && categories.length ? {
187
+ 'category.id': categories !== null && categories !== void 0 && categories.length ? {
188
188
  $all: categories.map(_ref => {
189
189
  var {
190
190
  id
@@ -192,19 +192,19 @@ function createClient(prezly, newsroomUuid, newsroomThemeUuid) {
192
192
  return id;
193
193
  })
194
194
  } : undefined,
195
- ["newsroom.uuid"]: {
195
+ 'newsroom.uuid': {
196
196
  $in: [newsroomUuid]
197
197
  },
198
- ["locale"]: localeCode ? {
198
+ locale: localeCode ? {
199
199
  $in: [localeCode]
200
200
  } : undefined,
201
- ["status"]: {
201
+ status: {
202
202
  $in: [_sdk.Story.Status.PUBLISHED]
203
203
  },
204
- ["visibility"]: {
204
+ visibility: {
205
205
  $in: [_sdk.Story.Visibility.PUBLIC]
206
206
  },
207
- ["tag.name"]: tags !== null && tags !== void 0 && tags.length ? {
207
+ 'tag.name': tags !== null && tags !== void 0 && tags.length ? {
208
208
  $any: tags
209
209
  } : undefined
210
210
  }),
@@ -261,13 +261,13 @@ function createClient(prezly, newsroomUuid, newsroomThemeUuid) {
261
261
  return yield prezly.stories.getBySlug(params.slug, {
262
262
  formats,
263
263
  query: {
264
- ["newsroom.uuid"]: {
264
+ 'newsroom.uuid': {
265
265
  $in: [newsroomUuid]
266
266
  },
267
- ["status"]: {
267
+ status: {
268
268
  $in: [_sdk.Story.Status.PUBLISHED, _sdk.Story.Status.EMBARGO]
269
269
  },
270
- ["visibility"]: {
270
+ visibility: {
271
271
  $in: [_sdk.Story.Visibility.PUBLIC, _sdk.Story.Visibility.PRIVATE, _sdk.Story.Visibility.EMBARGO]
272
272
  }
273
273
  },
@@ -176,7 +176,7 @@ export function createClient(prezly, newsroomUuid, newsroomThemeUuid) {
176
176
  offset: offset > 0 ? offset + highlighted : offset,
177
177
  search,
178
178
  query: mergeQueries(query, {
179
- ["category.id"]: categories !== null && categories !== void 0 && categories.length ? {
179
+ 'category.id': categories !== null && categories !== void 0 && categories.length ? {
180
180
  $all: categories.map(_ref => {
181
181
  var {
182
182
  id
@@ -184,19 +184,19 @@ export function createClient(prezly, newsroomUuid, newsroomThemeUuid) {
184
184
  return id;
185
185
  })
186
186
  } : undefined,
187
- ["newsroom.uuid"]: {
187
+ 'newsroom.uuid': {
188
188
  $in: [newsroomUuid]
189
189
  },
190
- ["locale"]: localeCode ? {
190
+ locale: localeCode ? {
191
191
  $in: [localeCode]
192
192
  } : undefined,
193
- ["status"]: {
193
+ status: {
194
194
  $in: [Story.Status.PUBLISHED]
195
195
  },
196
- ["visibility"]: {
196
+ visibility: {
197
197
  $in: [Story.Visibility.PUBLIC]
198
198
  },
199
- ["tag.name"]: tags !== null && tags !== void 0 && tags.length ? {
199
+ 'tag.name': tags !== null && tags !== void 0 && tags.length ? {
200
200
  $any: tags
201
201
  } : undefined
202
202
  }),
@@ -253,13 +253,13 @@ export function createClient(prezly, newsroomUuid, newsroomThemeUuid) {
253
253
  return yield prezly.stories.getBySlug(params.slug, {
254
254
  formats,
255
255
  query: {
256
- ["newsroom.uuid"]: {
256
+ 'newsroom.uuid': {
257
257
  $in: [newsroomUuid]
258
258
  },
259
- ["status"]: {
259
+ status: {
260
260
  $in: [Story.Status.PUBLISHED, Story.Status.EMBARGO]
261
261
  },
262
- ["visibility"]: {
262
+ visibility: {
263
263
  $in: [Story.Visibility.PUBLIC, Story.Visibility.PRIVATE, Story.Visibility.EMBARGO]
264
264
  }
265
265
  },
@@ -27,7 +27,7 @@ function createSharedMemoryCache() {
27
27
  CACHE.set("".concat(prefix).concat(key), {
28
28
  value,
29
29
  version,
30
- accessed: new Date().getTime()
30
+ accessed: Date.now()
31
31
  });
32
32
  return value;
33
33
  },
@@ -35,7 +35,7 @@ function createSharedMemoryCache() {
35
35
  var entry = {
36
36
  value,
37
37
  version,
38
- accessed: new Date().getTime()
38
+ accessed: Date.now()
39
39
  };
40
40
  CACHE.set("".concat(prefix).concat(key), entry);
41
41
  if (CACHE.size > RECORDS_LIMIT && Math.random() < GC_PROBABILITY) {
@@ -20,7 +20,7 @@ export function createSharedMemoryCache() {
20
20
  CACHE.set("".concat(prefix).concat(key), {
21
21
  value,
22
22
  version,
23
- accessed: new Date().getTime()
23
+ accessed: Date.now()
24
24
  });
25
25
  return value;
26
26
  },
@@ -28,7 +28,7 @@ export function createSharedMemoryCache() {
28
28
  var entry = {
29
29
  value,
30
30
  version,
31
- accessed: new Date().getTime()
31
+ accessed: Date.now()
32
32
  };
33
33
  CACHE.set("".concat(prefix).concat(key), entry);
34
34
  if (CACHE.size > RECORDS_LIMIT && Math.random() < GC_PROBABILITY) {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  'use client';
3
3
 
4
- /* eslint-disable @typescript-eslint/no-use-before-define */
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- /* eslint-disable @typescript-eslint/no-use-before-define */
4
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
5
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -15,10 +15,10 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
15
15
  var EN = 'en';
16
16
  var X_DEFAULT = 'x-default';
17
17
  var ALLOWED_FALLBACKS = {
18
- ["en_US"]: 'en',
19
- ["en_GB"]: 'en',
20
- ["fr_FR"]: 'fr',
21
- ["fr_CA"]: 'fr'
18
+ en_US: 'en',
19
+ en_GB: 'en',
20
+ fr_FR: 'fr',
21
+ fr_CA: 'fr'
22
22
  };
23
23
  function getAlternateLanguageLinks(availableLanguages, generateTranslationUrl) {
24
24
  var _links$EN;
@@ -9,10 +9,10 @@ import { isNotUndefined } from '@technically/is-not-undefined';
9
9
  var EN = 'en';
10
10
  var X_DEFAULT = 'x-default';
11
11
  var ALLOWED_FALLBACKS = {
12
- ["en_US"]: 'en',
13
- ["en_GB"]: 'en',
14
- ["fr_FR"]: 'fr',
15
- ["fr_CA"]: 'fr'
12
+ en_US: 'en',
13
+ en_GB: 'en',
14
+ fr_FR: 'fr',
15
+ fr_CA: 'fr'
16
16
  };
17
17
  export function getAlternateLanguageLinks(availableLanguages, generateTranslationUrl) {
18
18
  var _links$EN;
@@ -34,4 +34,7 @@ describe('getShortestLocaleSlug', () => {
34
34
  it('returns full code when trying to shorten to region code for es-419', () => {
35
35
  expect((0, _getShortestLocaleSlug.getShortestLocaleSlug)('es_419', context)).toBe('es-419');
36
36
  });
37
+ it('returns full code when trying to shorten to region code for zg-Hant', () => {
38
+ expect((0, _getShortestLocaleSlug.getShortestLocaleSlug)('zh_Hant', context)).toBe('zh-hant');
39
+ });
37
40
  });
@@ -32,4 +32,7 @@ describe('getShortestLocaleSlug', () => {
32
32
  it('returns full code when trying to shorten to region code for es-419', () => {
33
33
  expect(getShortestLocaleSlug('es_419', context)).toBe('es-419');
34
34
  });
35
+ it('returns full code when trying to shorten to region code for zg-Hant', () => {
36
+ expect(getShortestLocaleSlug('zh_Hant', context)).toBe('zh-hant');
37
+ });
35
38
  });
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _matchLocaleSlug = require("./matchLocaleSlug.cjs");
4
- /* eslint-disable @typescript-eslint/naming-convention */
5
-
6
4
  describe('matchLocaleSlug', () => {
7
5
  it('should match enabled locales by full locale slug', () => {
8
6
  var locales = ['nl_BE', 'nl_NL', 'en'];
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import { matchLocaleSlug } from "./matchLocaleSlug.mjs";
3
2
  describe('matchLocaleSlug', () => {
4
3
  it('should match enabled locales by full locale slug', () => {
package/package.json CHANGED
@@ -1,75 +1,78 @@
1
1
  {
2
- "name": "@prezly/theme-kit-core",
3
- "version": "10.5.0",
4
- "description": "Data layer and utility library for developing Prezly themes with JavaScript",
5
- "main": "build/index.mjs",
6
- "type": "module",
7
- "types": "build/index.d.ts",
8
- "files": [
9
- "build",
10
- "README.md"
11
- ],
12
- "exports": {
13
- ".": {
14
- "types": "./build/index.d.ts",
15
- "require": "./build/index.cjs",
16
- "default": "./build/index.mjs"
17
- }
18
- },
19
- "scripts": {
20
- "prebuild": "rimraf build/* *.tsbuildinfo",
21
- "build": "pnpm build:types && pnpm build:esm && pnpm build:cjs",
22
- "build:types": "tsc --project .",
23
- "build:esm": "babel --config-file=../../babel.esm.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.mjs",
24
- "build:cjs": "babel --config-file=../../babel.cjs.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.cjs",
25
- "dev": "tsc --watch --preserveWatchOutput --project .",
26
- "typecheck": "tsc --noEmit --emitDeclarationOnly false --incremental --project .",
27
- "lint": "eslint src",
28
- "test": "pnpm test:unit && pnpm test:build",
29
- "test:unit": "jest",
30
- "test:build": "pnpm test:build:cjs && pnpm test:build:esm && pnpm test:build:types",
31
- "test:build:types": "tsc --esModuleInterop --noEmit --target esnext --moduleResolution node build/index.d.ts",
32
- "test:build:esm": "node tests/test-build.mjs",
33
- "test:build:cjs": "node tests/test-build.cjs"
34
- },
35
- "peerDependencies": {
36
- "@prezly/sdk": "21.12.0 || ^23.x"
37
- },
38
- "dependencies": {
39
- "@prezly/theme-kit-intl": "^10.5.0",
40
- "@prezly/uploadcare": "2.4.4",
41
- "@technically/is-not-undefined": "^1.0.0",
42
- "@technically/omit-undefined": "^1.0.4",
43
- "parse-data-url": "^6.0.0",
44
- "url-pattern": "^1.0.3"
45
- },
46
- "devDependencies": {
47
- "@types/parse-data-url": "3.0.2"
48
- },
49
- "engines": {
50
- "node": ">= 16.x",
51
- "npm": ">= 8.x"
52
- },
53
- "devEngines": {
54
- "node": ">= 16.x",
55
- "npm": ">= 8.x"
56
- },
57
- "keywords": [
58
- "prezly"
59
- ],
60
- "author": "Prezly Team",
61
- "license": "MIT",
62
- "bugs": {
63
- "url": "https://github.com/prezly/theme-kit-js/issues"
64
- },
65
- "homepage": "https://github.com/prezly/theme-kit-js/tree/main/packages/core#readme",
66
- "repository": {
67
- "type": "git",
68
- "url": "git+https://github.com/prezly/theme-kit-js.git",
69
- "directory": "packages/core"
70
- },
71
- "publishConfig": {
72
- "access": "public"
73
- },
74
- "gitHead": "fba05f52e06db45ecab4e82c157be7f59fad04f3"
2
+ "name": "@prezly/theme-kit-core",
3
+ "version": "10.5.2",
4
+ "description": "Data layer and utility library for developing Prezly themes with JavaScript",
5
+ "main": "build/index.mjs",
6
+ "type": "module",
7
+ "types": "build/index.d.ts",
8
+ "files": [
9
+ "build",
10
+ "README.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./build/index.d.ts",
15
+ "require": "./build/index.cjs",
16
+ "default": "./build/index.mjs"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "prebuild": "rimraf build/* *.tsbuildinfo",
21
+ "build": "pnpm build:types && pnpm build:esm && pnpm build:cjs",
22
+ "build:types": "tsc --project .",
23
+ "build:esm": "babel --config-file=../../babel.esm.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.mjs",
24
+ "build:cjs": "babel --config-file=../../babel.cjs.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.cjs",
25
+ "dev": "tsc --watch --preserveWatchOutput --project .",
26
+ "typecheck": "tsc --noEmit --emitDeclarationOnly false --incremental --project .",
27
+ "lint": "biome lint src",
28
+ "lint:fix": "biome lint --write src",
29
+ "format": "biome format src",
30
+ "format:fix": "biome format --write src",
31
+ "test": "pnpm test:unit && pnpm test:build",
32
+ "test:unit": "jest",
33
+ "test:build": "pnpm test:build:cjs && pnpm test:build:esm && pnpm test:build:types",
34
+ "test:build:types": "tsc --esModuleInterop --noEmit --target esnext --moduleResolution node build/index.d.ts",
35
+ "test:build:esm": "node tests/test-build.mjs",
36
+ "test:build:cjs": "node tests/test-build.cjs"
37
+ },
38
+ "peerDependencies": {
39
+ "@prezly/sdk": "21.12.0 || ^23.x"
40
+ },
41
+ "dependencies": {
42
+ "@prezly/theme-kit-intl": "^10.5.1",
43
+ "@prezly/uploadcare": "2.4.4",
44
+ "@technically/is-not-undefined": "^1.0.0",
45
+ "@technically/omit-undefined": "^1.0.4",
46
+ "parse-data-url": "^6.0.0",
47
+ "url-pattern": "^1.0.3"
48
+ },
49
+ "devDependencies": {
50
+ "@types/parse-data-url": "3.0.2"
51
+ },
52
+ "engines": {
53
+ "node": ">= 16.x",
54
+ "npm": ">= 8.x"
55
+ },
56
+ "devEngines": {
57
+ "node": ">= 16.x",
58
+ "npm": ">= 8.x"
59
+ },
60
+ "keywords": [
61
+ "prezly"
62
+ ],
63
+ "author": "Prezly Team",
64
+ "license": "MIT",
65
+ "bugs": {
66
+ "url": "https://github.com/prezly/theme-kit-js/issues"
67
+ },
68
+ "homepage": "https://github.com/prezly/theme-kit-js/tree/main/packages/core#readme",
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://github.com/prezly/theme-kit-js.git",
72
+ "directory": "packages/core"
73
+ },
74
+ "publishConfig": {
75
+ "access": "public"
76
+ },
77
+ "gitHead": "8fd422777f84523ae315f086b0395e33da3d8507"
75
78
  }