@omerlo/omerlo-webkit 0.0.28 → 0.0.30

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.
@@ -32,6 +32,8 @@ export interface IssueSummary {
32
32
  issueType: IssueType;
33
33
  kind: 'pdf' | 'regular';
34
34
  name: string;
35
+ descriptionHtml: string | null;
36
+ descriptionText: string | null;
35
37
  color: string | null;
36
38
  pdfUrl: string | null;
37
39
  visual: Visual | null;
@@ -45,8 +47,6 @@ export interface IssueSummary {
45
47
  }
46
48
  export interface Issue extends IssueSummary {
47
49
  advertisingKey: string | null;
48
- descriptionHtml: string | null;
49
- descriptionText: string | null;
50
50
  sections: IssueSectionSummary[];
51
51
  }
52
52
  export interface IssueType {
@@ -45,6 +45,8 @@ export function parseIssueSummary(data, assocs) {
45
45
  issueType: getAssoc(assocs, 'issue_types', data.issue_type_id),
46
46
  kind: data.kind,
47
47
  name: data.name,
48
+ descriptionText: data.description_text,
49
+ descriptionHtml: data.description_html,
48
50
  color: data.color,
49
51
  pdfUrl: data.pdf_url,
50
52
  visual: parseVisual(data.visual, assocs),
@@ -59,8 +61,6 @@ export function parseIssue(data, assocs) {
59
61
  return {
60
62
  ...parseIssueSummary(data, assocs),
61
63
  advertisingKey: data.advertising_key,
62
- descriptionText: data.description_text,
63
- descriptionHtml: data.description_html,
64
64
  sections: data.sections.map((section) => parseIssueSectionSummary(section, assocs))
65
65
  };
66
66
  }
@@ -1,6 +1,6 @@
1
1
  import type { ApiAssocs, PagingParams } from '../utils/api';
2
2
  import { type ApiData } from '../utils/api';
3
- import type { LocalesMetadata } from '../utils/response';
3
+ import { type LocalesMetadata } from '../utils/response';
4
4
  import type { Category } from './categories';
5
5
  import { type ProfileAddress } from './profiles';
6
6
  import { type ProfileContact } from './profiles';
@@ -1,5 +1,6 @@
1
1
  import { parseMany } from '../utils/api';
2
2
  import { getAssoc, getAssocs } from '../utils/assocs';
3
+ import { parseLocalesMetadata } from '../utils/response';
3
4
  import { parseProfileAddress } from './profiles';
4
5
  import { parseProfileContact } from './profiles';
5
6
  import { parseProfileDescription } from './profiles';
@@ -26,6 +27,22 @@ export function getOrganization(f) {
26
27
  };
27
28
  }
28
29
  export function parseOrganizationSummary(data, assocs) {
30
+ let localizedField;
31
+ // NOTE: This is to support publisher public api v2
32
+ if (data.localized) {
33
+ localizedField = {
34
+ summaryHtml: data.localized.summary_html,
35
+ summaryText: data.localized.summary_text,
36
+ meta: buildMeta(data.localized.locale)
37
+ };
38
+ }
39
+ else {
40
+ localizedField = {
41
+ summaryHtml: data.summary_html,
42
+ summaryText: data.summary_text,
43
+ meta: { locales: parseLocalesMetadata(data.meta) }
44
+ };
45
+ }
29
46
  return {
30
47
  id: data.id,
31
48
  profileType: getAssoc(assocs, 'profile_types', data.profile_type_id),
@@ -33,9 +50,7 @@ export function parseOrganizationSummary(data, assocs) {
33
50
  name: data.name,
34
51
  // NOTE remove logo_image_url once using reader api
35
52
  profileImageURL: data.logo_image_url || data.profile_image_url,
36
- meta: buildMeta(data.localized?.locale),
37
- summaryHtml: data.localized?.summary_html,
38
- summaryText: data.localized?.summary_text,
53
+ ...localizedField,
39
54
  updatedAt: new Date(data.updated_at)
40
55
  };
41
56
  }
@@ -1,6 +1,6 @@
1
1
  import type { Category } from './categories';
2
2
  import { type ApiAssocs, type ApiData, type PagingParams } from '../utils/api';
3
- import type { LocalesMetadata } from '../utils/response';
3
+ import { type LocalesMetadata } from '../utils/response';
4
4
  import { type ProfileAddress } from './profiles';
5
5
  import { type ProfileContact } from './profiles';
6
6
  import { type ProfileDescription } from './profiles';
@@ -1,4 +1,5 @@
1
1
  import { parseMany } from '../utils/api';
2
+ import { parseLocalesMetadata } from '../utils/response';
2
3
  import { parseProfileAddress } from './profiles';
3
4
  import { parseProfileContact } from './profiles';
4
5
  import { parseProfileDescription } from './profiles';
@@ -26,6 +27,22 @@ export function getPerson(f) {
26
27
  };
27
28
  }
28
29
  export function parsePersonSummary(data, assocs) {
30
+ let localizedField;
31
+ // NOTE: This is to support publisher public api v2
32
+ if (data.localized) {
33
+ localizedField = {
34
+ summaryHtml: data.localized.summary_html,
35
+ summaryText: data.localized.summary_text,
36
+ meta: buildMeta(data.localized.locale)
37
+ };
38
+ }
39
+ else {
40
+ localizedField = {
41
+ summaryHtml: data.summary_html,
42
+ summaryText: data.summary_text,
43
+ meta: { locales: parseLocalesMetadata(data.meta) }
44
+ };
45
+ }
29
46
  return {
30
47
  id: data.id,
31
48
  profileType: getAssoc(assocs, 'profile_types', data.profile_type_id),
@@ -37,9 +54,7 @@ export function parsePersonSummary(data, assocs) {
37
54
  // NOTE remove logo_image_url once using reader api
38
55
  profileImageURL: data.avatar_image_url || data.profile_image_url,
39
56
  coverImageURL: data.cover_image_url,
40
- meta: buildMeta(data.localized?.locale),
41
- summaryHtml: data.localized?.summary_html,
42
- summaryText: data.localized?.summary_text,
57
+ ...localizedField,
43
58
  updatedAt: new Date(data.updated_at)
44
59
  };
45
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omerlo/omerlo-webkit",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",