@omerlo/omerlo-webkit 0.0.29 → 0.0.31

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.
@@ -11,6 +11,7 @@ export declare const useReader: (f: typeof fetch) => {
11
11
  searchContents: (issueId: string, q: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").SectionContent[]>>;
12
12
  getSectionContents: (sectionId: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ContentSummary[]>>;
13
13
  };
14
+ getReference: (key: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader/endpoints/integration").Reference>>;
14
15
  listProjects: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").ProjectSummary[]>>;
15
16
  getProject: (id: string) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").Project>>;
16
17
  listPeople: (params?: Partial<import("./reader/utils/api").PagingParams>) => Promise<import("./reader/utils/api").ApiResponse<import("./reader").PersonSummary[]>>;
@@ -0,0 +1,11 @@
1
+ import type { ApiAssocs, ApiData } from '../utils/api';
2
+ export declare const integrationFetchers: (f: typeof fetch) => {
3
+ getReference: (key: string) => Promise<import("../utils/api").ApiResponse<Reference>>;
4
+ };
5
+ export declare function getReference(f: typeof fetch): (key: string) => Promise<import("../utils/api").ApiResponse<Reference>>;
6
+ export interface Reference {
7
+ id: string;
8
+ provider: string;
9
+ urn: string;
10
+ }
11
+ export declare function parseReference(data: ApiData, _assocs: ApiAssocs): Reference;
@@ -0,0 +1,19 @@
1
+ import { requestPublisher } from '../utils/request';
2
+ export const integrationFetchers = (f) => {
3
+ return {
4
+ getReference: getReference(f)
5
+ };
6
+ };
7
+ export function getReference(f) {
8
+ return async (key) => {
9
+ const opts = { parser: parseReference };
10
+ return requestPublisher(f, `/references/${key}`, opts);
11
+ };
12
+ }
13
+ export function parseReference(data, _assocs) {
14
+ return {
15
+ id: data.id,
16
+ provider: data.provider,
17
+ urn: data.urn
18
+ };
19
+ }
@@ -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
  }
@@ -11,6 +11,7 @@ export declare const fetchers: (f: typeof fetch) => {
11
11
  searchContents: (issueId: string, q: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/magazines").SectionContent[]>>;
12
12
  getSectionContents: (sectionId: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/contents").ContentSummary[]>>;
13
13
  };
14
+ getReference: (key: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/integration").Reference>>;
14
15
  listProjects: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/projects").ProjectSummary[]>>;
15
16
  getProject: (id: string) => Promise<import("./utils/api").ApiResponse<import("./endpoints/projects").Project>>;
16
17
  listPeople: (params?: Partial<import("./utils/api").PagingParams>) => Promise<import("./utils/api").ApiResponse<import("./endpoints/person").PersonSummary[]>>;
@@ -1,6 +1,7 @@
1
1
  import { accountsFetchers } from './endpoints/accounts';
2
2
  import { categoriesFetchers } from './endpoints/categories';
3
3
  import { deviceFetchers } from './endpoints/device';
4
+ import { integrationFetchers } from './endpoints/integration';
4
5
  import { notificationFetchers } from './endpoints/notification';
5
6
  import { oauthFetchers } from './endpoints/oauth';
6
7
  import { contentsFetchers } from './endpoints/contents';
@@ -27,6 +28,7 @@ export const fetchers = (f) => {
27
28
  ...eventFetchers(f),
28
29
  ...personFetchers(f),
29
30
  ...projectFetchers(f),
31
+ ...integrationFetchers(f),
30
32
  notifications: notificationFetchers(f),
31
33
  magazines: {
32
34
  ...magazineFetchers(f),
@@ -11,7 +11,9 @@ export interface ApiResponse<T> {
11
11
  meta: ApiResponseMeta | null;
12
12
  }
13
13
  export interface ApiResponseMeta {
14
+ base: string;
14
15
  next: string | null;
16
+ previous: string | null;
15
17
  }
16
18
  export interface ApiParams {
17
19
  locale?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omerlo/omerlo-webkit",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",