@glissandoo/lib 1.8.1 → 1.9.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.
@@ -1,11 +1,11 @@
1
- import { Node } from 'slate';
1
+ import { Descendant } from '../helpers/slate';
2
2
  import { CommunicationType } from '../models/Communication/types';
3
3
  export declare namespace CommunicationFbFunctionsTypes {
4
4
  interface PublishParams {
5
5
  commId: string;
6
6
  groupId: string;
7
7
  title: string;
8
- message: Node[];
8
+ message: Descendant[];
9
9
  recipients: string[];
10
10
  templateId: string | null;
11
11
  type: CommunicationType;
@@ -17,7 +17,7 @@ export declare namespace CommunicationFbFunctionsTypes {
17
17
  commId: string;
18
18
  groupId: string;
19
19
  title: string;
20
- message: Node[];
20
+ message: Descendant[];
21
21
  recipients: string[];
22
22
  templateId: string | null;
23
23
  type: CommunicationType;
@@ -1,3 +1,4 @@
1
+ import { Descendant } from '../helpers/slate';
1
2
  import { EventPlayerStatus } from '../models/Evento/Player/types';
2
3
  import { EventRepeatPeriod, EventStage, EventType } from '../models/Evento/types';
3
4
  export declare namespace EventoFbFunctionsTypes {
@@ -16,6 +17,7 @@ export declare namespace EventoFbFunctionsTypes {
16
17
  datetimeEnd: number;
17
18
  userIds: string[];
18
19
  description: string | null;
20
+ descriptionSlate: Descendant[];
19
21
  period: EventRepeatPeriod | null;
20
22
  until: number | null;
21
23
  timezone: string;
@@ -63,6 +65,7 @@ export declare namespace EventoFbFunctionsTypes {
63
65
  scope: EditScope.Comments;
64
66
  value: {
65
67
  description: string | null;
68
+ descriptionSlate: Descendant[];
66
69
  };
67
70
  }
68
71
  type EditCommentsParams = EditCommentsData & EditParamsBase;
@@ -0,0 +1,15 @@
1
+ export declare type Descendant = Element | Text;
2
+ export declare type Element = ExtendedType<'Element', BaseElement>;
3
+ export interface BaseElement {
4
+ children: Descendant[];
5
+ }
6
+ export declare type Text = ExtendedType<'Text', BaseText>;
7
+ export interface BaseText {
8
+ text: string;
9
+ }
10
+ declare type ExtendableTypes = 'Editor' | 'Element' | 'Text';
11
+ export interface CustomTypes {
12
+ [key: string]: unknown;
13
+ }
14
+ export declare type ExtendedType<K extends ExtendableTypes, B> = unknown extends CustomTypes[K] ? B : CustomTypes[K];
15
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
- import { Node } from 'slate';
2
1
  import { LanguagesTypes } from '../lang';
3
2
  import { MetaNotificationData } from '../models/User/Notification/types';
3
+ import { Descendant } from './slate';
4
4
  export declare const replaceVarsBrackets: (string: string, values: MetaNotificationData) => string;
5
5
  export declare const replaceKeysNotification: (string: string, values: MetaNotificationData, lang: LanguagesTypes) => string;
6
- export declare const serializeSlateBlock: (nodes: Node[]) => string;
6
+ export declare const serializeSlateBlock: (nodes: Descendant[]) => string;
package/helpers/utils.js CHANGED
@@ -90,9 +90,8 @@ const serializeSlateBlock = (nodes) => {
90
90
  if (children) {
91
91
  return exports.serializeSlateBlock(children);
92
92
  }
93
- else {
94
- return node.text.trim() || '';
95
- }
93
+ const text = get_1.default(node, 'text');
94
+ return text || '';
96
95
  })
97
96
  .join(' ');
98
97
  };
@@ -6,7 +6,7 @@ export default class Communication extends Model<CommunicationData> {
6
6
  protected lang: LanguagesTypes;
7
7
  constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
8
8
  get title(): string;
9
- get message(): import("slate").Node[];
9
+ get message(): import("../../helpers/slate").Descendant[];
10
10
  get promoter(): DocumentReference;
11
11
  get promoterInfo(): import("../Group/types").GroupTinyData;
12
12
  get owner(): DocumentReference;
@@ -1,5 +1,5 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
- import { Node } from 'slate';
2
+ import { Descendant } from '../../helpers/slate';
3
3
  import { GroupTinyData } from '../Group/types';
4
4
  import { UserTinyData } from '../User/types';
5
5
  export declare enum CommunicationType {
@@ -45,7 +45,7 @@ export interface CommunicationRecipientData {
45
45
  }
46
46
  export interface CommunicationData {
47
47
  title: string;
48
- message: Node[];
48
+ message: Descendant[];
49
49
  type: CommunicationType;
50
50
  readonly promoter: DocumentReference;
51
51
  promoterInfo: GroupTinyData;
@@ -10,6 +10,7 @@ export default class Evento extends EventoPromoter<EventData> {
10
10
  get videoURL(): string | null;
11
11
  get coverURL(): string | null;
12
12
  get description(): string | null;
13
+ get descriptionSlate(): import("../../helpers/slate").Descendant[];
13
14
  get owner(): DocumentReference;
14
15
  get relEvents(): string[];
15
16
  get isASerie(): boolean;
@@ -38,6 +38,9 @@ class Evento extends promoter_1.default {
38
38
  get description() {
39
39
  return this.data.description || null;
40
40
  }
41
+ get descriptionSlate() {
42
+ return this.data.descriptionSlate || [];
43
+ }
41
44
  get owner() {
42
45
  return this.data.owner;
43
46
  }
@@ -1,4 +1,5 @@
1
1
  import { DocumentReference, GeoPoint, Timestamp } from '@google-cloud/firestore';
2
+ import { Descendant } from '../../helpers/slate';
2
3
  import { StageTemplate } from '../../helpers/types';
3
4
  import { GroupBasicData } from '../Group/types';
4
5
  import { PlayerBasicData } from '../Player/types';
@@ -68,6 +69,7 @@ export interface EventData extends EventPromoterData {
68
69
  coverURL: string | null;
69
70
  videoURL: string | null;
70
71
  description: string | null;
72
+ descriptionSlate: Descendant[];
71
73
  playerIds: string[];
72
74
  players: Record<string, EventPlayerBasicData>;
73
75
  repertoryIds: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -29,7 +29,6 @@
29
29
  "devDependencies": {
30
30
  "@types/lodash": "^4.14.168",
31
31
  "@types/node": "^12.19.13",
32
- "@types/slate": "^0.47.8",
33
32
  "@typescript-eslint/eslint-plugin": "^4.22.0",
34
33
  "@typescript-eslint/parser": "^4.22.0",
35
34
  "eslint": "^7.24.0",