@prezly/theme-kit-nextjs 1.10.1 → 1.10.2-0

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,4 @@
1
+ import type { NewsroomCompanyInformation } from '@prezly/sdk';
2
+ export declare function hasAnySocialMedia(companyInformation: NewsroomCompanyInformation): boolean;
3
+ export declare function hasAnyAboutInformation(companyInformation: NewsroomCompanyInformation): boolean;
4
+ export declare function hasAnyContactInformation(companyInformation: NewsroomCompanyInformation): boolean;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasAnyContactInformation = exports.hasAnyAboutInformation = exports.hasAnySocialMedia = void 0;
4
+ function hasAnySocialMedia(companyInformation) {
5
+ return Boolean(companyInformation.facebook ||
6
+ companyInformation.instagram ||
7
+ companyInformation.linkedin ||
8
+ companyInformation.pinterest ||
9
+ companyInformation.tiktok ||
10
+ companyInformation.twitter ||
11
+ companyInformation.youtube);
12
+ }
13
+ exports.hasAnySocialMedia = hasAnySocialMedia;
14
+ function hasAnyAboutInformation(companyInformation) {
15
+ return Boolean(companyInformation.about ||
16
+ companyInformation.website ||
17
+ hasAnySocialMedia(companyInformation));
18
+ }
19
+ exports.hasAnyAboutInformation = hasAnyAboutInformation;
20
+ function hasAnyContactInformation(companyInformation) {
21
+ return Boolean(companyInformation.address || companyInformation.phone || companyInformation.email);
22
+ }
23
+ exports.hasAnyContactInformation = hasAnyContactInformation;
24
+ //# sourceMappingURL=boilerplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boilerplate.js","sourceRoot":"","sources":["../../src/data-fetching/boilerplate.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAAC,kBAA8C;IAC5E,OAAO,OAAO,CACV,kBAAkB,CAAC,QAAQ;QACvB,kBAAkB,CAAC,SAAS;QAC5B,kBAAkB,CAAC,QAAQ;QAC3B,kBAAkB,CAAC,SAAS;QAC5B,kBAAkB,CAAC,MAAM;QACzB,kBAAkB,CAAC,OAAO;QAC1B,kBAAkB,CAAC,OAAO,CACjC,CAAC;AACN,CAAC;AAVD,8CAUC;AAED,SAAgB,sBAAsB,CAAC,kBAA8C;IACjF,OAAO,OAAO,CACV,kBAAkB,CAAC,KAAK;QACpB,kBAAkB,CAAC,OAAO;QAC1B,iBAAiB,CAAC,kBAAkB,CAAC,CAC5C,CAAC;AACN,CAAC;AAND,wDAMC;AAED,SAAgB,wBAAwB,CAAC,kBAA8C;IACnF,OAAO,OAAO,CACV,kBAAkB,CAAC,OAAO,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAAC,KAAK,CACrF,CAAC;AACN,CAAC;AAJD,4DAIC"}
@@ -0,0 +1,3 @@
1
+ import type { Newsroom } from '@prezly/sdk';
2
+ import type { LocaleObject } from '../intl';
3
+ export declare function getDataRequestLink(newsroom: Newsroom, currentLocale: LocaleObject): string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDataRequestLink = void 0;
4
+ var getPrivacyPortalUrl_1 = require("./getPrivacyPortalUrl");
5
+ function getDataRequestLink(newsroom, currentLocale) {
6
+ return (newsroom.custom_data_request_link ||
7
+ (0, getPrivacyPortalUrl_1.getPrivacyPortalUrl)(newsroom, currentLocale, {
8
+ action: 'data-request',
9
+ }));
10
+ }
11
+ exports.getDataRequestLink = getDataRequestLink;
12
+ //# sourceMappingURL=getDataRequestLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDataRequestLink.js","sourceRoot":"","sources":["../../src/data-fetching/getDataRequestLink.ts"],"names":[],"mappings":";;;AAIA,6DAA4D;AAE5D,SAAgB,kBAAkB,CAAC,QAAkB,EAAE,aAA2B;IAC9E,OAAO,CACH,QAAQ,CAAC,wBAAwB;QACjC,IAAA,yCAAmB,EAAC,QAAQ,EAAE,aAAa,EAAE;YACzC,MAAM,EAAE,cAAc;SACzB,CAAC,CACL,CAAC;AACN,CAAC;AAPD,gDAOC"}
@@ -1,10 +1,13 @@
1
1
  export * from './api';
2
+ export * from './boilerplate';
2
3
  export * from './constants';
3
4
  export * from './getAssetsUrl';
5
+ export * from './getDataRequestLink';
4
6
  export * from './getLocalizedCategoryData';
5
7
  export * from './getNewsroomLogoUrl';
6
8
  export * from './getPrivacyPortalUrl';
7
9
  export * from './getStoryPublicationDate';
8
10
  export * from './getUploadcareGroupUrl';
11
+ export * from './isEmbargoStory';
9
12
  export * from './lib';
10
13
  export * from './types';
@@ -11,13 +11,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./api"), exports);
14
+ __exportStar(require("./boilerplate"), exports);
14
15
  __exportStar(require("./constants"), exports);
15
16
  __exportStar(require("./getAssetsUrl"), exports);
17
+ __exportStar(require("./getDataRequestLink"), exports);
16
18
  __exportStar(require("./getLocalizedCategoryData"), exports);
17
19
  __exportStar(require("./getNewsroomLogoUrl"), exports);
18
20
  __exportStar(require("./getPrivacyPortalUrl"), exports);
19
21
  __exportStar(require("./getStoryPublicationDate"), exports);
20
22
  __exportStar(require("./getUploadcareGroupUrl"), exports);
23
+ __exportStar(require("./isEmbargoStory"), exports);
21
24
  __exportStar(require("./lib"), exports);
22
25
  __exportStar(require("./types"), exports);
23
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-fetching/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB;AACtB,8CAA4B;AAC5B,iDAA+B;AAC/B,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,wCAAsB;AACtB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-fetching/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB;AACtB,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mDAAiC;AACjC,wCAAsB;AACtB,0CAAwB"}
@@ -0,0 +1,6 @@
1
+ import type { Story } from '@prezly/sdk';
2
+ export declare type EmbargoStory = Omit<Story, 'is_embargo' | 'published_at'> & {
3
+ is_embargo: true;
4
+ published_at: string;
5
+ };
6
+ export declare function isEmbargoStory(story: Story): story is EmbargoStory;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEmbargoStory = void 0;
4
+ function isEmbargoStory(story) {
5
+ return story.is_embargo && Boolean(story.published_at);
6
+ }
7
+ exports.isEmbargoStory = isEmbargoStory;
8
+ //# sourceMappingURL=isEmbargoStory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/data-fetching/isEmbargoStory.ts"],"names":[],"mappings":";;;AAOA,SAAgB,cAAc,CAAC,KAAY;IACvC,OAAO,KAAK,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC;AAFD,wCAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "1.10.1",
3
+ "version": "1.10.2-0",
4
4
  "description": "Data layer and utility library for developing Prezly themes with NextJS",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -0,0 +1,27 @@
1
+ import type { NewsroomCompanyInformation } from '@prezly/sdk';
2
+
3
+ export function hasAnySocialMedia(companyInformation: NewsroomCompanyInformation): boolean {
4
+ return Boolean(
5
+ companyInformation.facebook ||
6
+ companyInformation.instagram ||
7
+ companyInformation.linkedin ||
8
+ companyInformation.pinterest ||
9
+ companyInformation.tiktok ||
10
+ companyInformation.twitter ||
11
+ companyInformation.youtube,
12
+ );
13
+ }
14
+
15
+ export function hasAnyAboutInformation(companyInformation: NewsroomCompanyInformation): boolean {
16
+ return Boolean(
17
+ companyInformation.about ||
18
+ companyInformation.website ||
19
+ hasAnySocialMedia(companyInformation),
20
+ );
21
+ }
22
+
23
+ export function hasAnyContactInformation(companyInformation: NewsroomCompanyInformation): boolean {
24
+ return Boolean(
25
+ companyInformation.address || companyInformation.phone || companyInformation.email,
26
+ );
27
+ }
@@ -0,0 +1,14 @@
1
+ import type { Newsroom } from '@prezly/sdk';
2
+
3
+ import type { LocaleObject } from '../intl';
4
+
5
+ import { getPrivacyPortalUrl } from './getPrivacyPortalUrl';
6
+
7
+ export function getDataRequestLink(newsroom: Newsroom, currentLocale: LocaleObject) {
8
+ return (
9
+ newsroom.custom_data_request_link ||
10
+ getPrivacyPortalUrl(newsroom, currentLocale, {
11
+ action: 'data-request',
12
+ })
13
+ );
14
+ }
@@ -1,10 +1,13 @@
1
1
  export * from './api';
2
+ export * from './boilerplate';
2
3
  export * from './constants';
3
4
  export * from './getAssetsUrl';
5
+ export * from './getDataRequestLink';
4
6
  export * from './getLocalizedCategoryData';
5
7
  export * from './getNewsroomLogoUrl';
6
8
  export * from './getPrivacyPortalUrl';
7
9
  export * from './getStoryPublicationDate';
8
10
  export * from './getUploadcareGroupUrl';
11
+ export * from './isEmbargoStory';
9
12
  export * from './lib';
10
13
  export * from './types';
@@ -0,0 +1,10 @@
1
+ import type { Story } from '@prezly/sdk';
2
+
3
+ export type EmbargoStory = Omit<Story, 'is_embargo' | 'published_at'> & {
4
+ is_embargo: true;
5
+ published_at: string;
6
+ };
7
+
8
+ export function isEmbargoStory(story: Story): story is EmbargoStory {
9
+ return story.is_embargo && Boolean(story.published_at);
10
+ }