@prezly/theme-kit-core 5.0.0-alpha.4 → 5.0.0-alpha.5

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.
@@ -9,3 +9,4 @@ export * from './getPrivacyPortalUrl';
9
9
  export * from './getStoryPublicationDate';
10
10
  export * from './getUploadcareGroupUrl';
11
11
  export * from './isEmbargoStory';
12
+ export * from './sdkHelpers';
@@ -25,4 +25,5 @@ __exportStar(require("./getPrivacyPortalUrl"), exports);
25
25
  __exportStar(require("./getStoryPublicationDate"), exports);
26
26
  __exportStar(require("./getUploadcareGroupUrl"), exports);
27
27
  __exportStar(require("./isEmbargoStory"), exports);
28
+ __exportStar(require("./sdkHelpers"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mDAAiC;AACjC,+CAA6B"}
@@ -1,4 +1,4 @@
1
- import { Story } from '@prezly/sdk';
1
+ import type { Story } from '@prezly/sdk';
2
2
  export type EmbargoStory = Omit<Story, 'is_embargo' | 'published_at'> & {
3
3
  is_embargo: true;
4
4
  published_at: string;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isEmbargoStory = void 0;
4
- const sdk_1 = require("@prezly/sdk");
4
+ const sdkHelpers_1 = require("./sdkHelpers");
5
5
  function isEmbargoStory(story) {
6
- // TODO: This leaks `@prezly/sdk` into client bundle
7
- return sdk_1.Story.isScheduledEmbargo(story.status);
6
+ return (0, sdkHelpers_1.isScheduledEmbargo)(story.status);
8
7
  }
9
8
  exports.isEmbargoStory = isEmbargoStory;
10
9
  //# sourceMappingURL=isEmbargoStory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAOpC,SAAgB,cAAc,CAAC,KAA4B;IACvD,oDAAoD;IACpD,OAAO,WAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAHD,wCAGC"}
1
+ {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":";;;AAEA,6CAAkD;AAOlD,SAAgB,cAAc,CAAC,KAA4B;IACvD,OAAO,IAAA,+BAAkB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAFD,wCAEC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * These helpers and enums are ported from @prezly/sdk to avoid leaking the dependency into the client bundle.
3
+ * The types are matching SDK v15.
4
+ */
5
+ import type { Story } from '@prezly/sdk';
6
+ export declare enum Visibility {
7
+ PUBLIC = "public",
8
+ EMBARGO = "embargo",
9
+ PRIVATE = "private",
10
+ CONFIDENTIAL = "confidential"
11
+ }
12
+ export declare enum Status {
13
+ UNINITIALIZED = "uninitialized",
14
+ DRAFT = "draft",
15
+ SCHEDULED = "scheduled",
16
+ EMBARGO = "embargo",
17
+ PUBLISHED = "published"
18
+ }
19
+ /**
20
+ * @see https://github.com/prezly/javascript-sdk/blob/8c735968415ded334f60635a8cef66f76a20a73f/src/types/Story.ts#L337
21
+ */
22
+ export declare function isStoryPublished(status: Status): boolean;
23
+ export declare function isStoryPublished(story: Pick<Story, 'status'>): boolean;
24
+ /**
25
+ * @see https://github.com/prezly/javascript-sdk/blob/8c735968415ded334f60635a8cef66f76a20a73f/src/types/Story.ts#L328
26
+ */
27
+ export declare function isScheduledEmbargo(status: Status): boolean;
28
+ export declare function isScheduledEmbargo(story: Pick<Story, 'status'>): boolean;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * These helpers and enums are ported from @prezly/sdk to avoid leaking the dependency into the client bundle.
4
+ * The types are matching SDK v15.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isScheduledEmbargo = exports.isStoryPublished = exports.Status = exports.Visibility = void 0;
8
+ var Visibility;
9
+ (function (Visibility) {
10
+ Visibility["PUBLIC"] = "public";
11
+ Visibility["EMBARGO"] = "embargo";
12
+ Visibility["PRIVATE"] = "private";
13
+ Visibility["CONFIDENTIAL"] = "confidential";
14
+ })(Visibility = exports.Visibility || (exports.Visibility = {}));
15
+ var Status;
16
+ (function (Status) {
17
+ Status["UNINITIALIZED"] = "uninitialized";
18
+ Status["DRAFT"] = "draft";
19
+ Status["SCHEDULED"] = "scheduled";
20
+ Status["EMBARGO"] = "embargo";
21
+ Status["PUBLISHED"] = "published";
22
+ })(Status = exports.Status || (exports.Status = {}));
23
+ function isStoryPublished(arg) {
24
+ if (typeof arg === 'object' && arg !== null) {
25
+ return isStoryPublished(arg.status);
26
+ }
27
+ return arg === Status.PUBLISHED;
28
+ }
29
+ exports.isStoryPublished = isStoryPublished;
30
+ function isScheduledEmbargo(arg) {
31
+ if (typeof arg === 'object' && arg !== null) {
32
+ return isScheduledEmbargo(arg.status);
33
+ }
34
+ return arg === Status.EMBARGO;
35
+ }
36
+ exports.isScheduledEmbargo = isScheduledEmbargo;
37
+ //# sourceMappingURL=sdkHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdkHelpers.js","sourceRoot":"","sources":["../../src/utils/sdkHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,2CAA6B,CAAA;AACjC,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB;AAED,IAAY,MAMX;AAND,WAAY,MAAM;IACd,yCAA+B,CAAA;IAC/B,yBAAe,CAAA;IACf,iCAAuB,CAAA;IACvB,6BAAmB,CAAA;IACnB,iCAAuB,CAAA;AAC3B,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AAOD,SAAgB,gBAAgB,CAAC,GAAmC;IAChE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE;QACzC,OAAO,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACvC;IACD,OAAO,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC;AACpC,CAAC;AALD,4CAKC;AAOD,SAAgB,kBAAkB,CAAC,GAAmC;IAClE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE;QACzC,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACzC;IACD,OAAO,GAAG,KAAK,MAAM,CAAC,OAAO,CAAC;AAClC,CAAC;AALD,gDAKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-core",
3
- "version": "5.0.0-alpha.4",
3
+ "version": "5.0.0-alpha.5",
4
4
  "description": "Data layer and utility library for developing Prezly themes with JavaScript",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -51,5 +51,5 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "gitHead": "7936f3b943da650ddbc4f6081b8a3d5b0e4850ac"
54
+ "gitHead": "d8da29d9d5b0e66dbd98953a5d92e663722b1aae"
55
55
  }