@dotbase/safe-frame-sync 1.0.0 → 1.1.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.
package/README.md CHANGED
@@ -27,7 +27,9 @@ npm run build
27
27
  The package is published on npmjs.
28
28
 
29
29
  ```bash
30
- npm publish
30
+ npm run build
31
+ npm login
32
+ npm publish --access public
31
33
  ```
32
34
 
33
35
  ## Usage
@@ -43,12 +45,6 @@ The package provides two essential functions:
43
45
  * `publishMessage` for sending typed messages
44
46
  * `subscribeMessage` for listening to specific typed messages
45
47
 
46
- Currently there are three message types and each of them specifies a data interface:
47
-
48
- * `editResource`
49
- * `createResource`
50
- * `closeBuilder`
51
-
52
48
  ### Message Types
53
49
 
54
50
  ### In Parent
package/dist/index.d.ts CHANGED
@@ -1,5 +1,14 @@
1
- export type MessageType = "editResource" | "createResource" | "closeBuilder";
1
+ export type MessageType = "editResource" | "createResource" | "closeBuilder" | "setBreadcrumbs" | "goToPatient";
2
2
  export type WorkflowType = "document" | "patient-report";
3
+ export interface BreadcrumbItemType {
4
+ to: string;
5
+ label: string;
6
+ }
7
+ export interface BreadcrumbsType {
8
+ currentPage: string;
9
+ back?: BreadcrumbItemType;
10
+ links?: BreadcrumbItemType[];
11
+ }
3
12
  export interface EditResourceType {
4
13
  type: "editResource";
5
14
  resourceId: string;
@@ -15,13 +24,25 @@ export interface CreateResourceType {
15
24
  export interface CloseBuilderType {
16
25
  type: "closeBuilder";
17
26
  }
18
- export type MesssageDataType = EditResourceType | CreateResourceType | CloseBuilderType;
27
+ export interface SetBreadcrumbsType {
28
+ type: "setBreadcrumbs";
29
+ breadcrumbs: BreadcrumbsType;
30
+ }
31
+ export interface GoToPatientType {
32
+ type: "goToPatient";
33
+ patientId: string;
34
+ }
35
+ export type MesssageDataType = EditResourceType | CreateResourceType | CloseBuilderType | SetBreadcrumbsType | GoToPatientType;
19
36
  export interface MessageDataMapType {
20
37
  editResource: EditResourceType;
21
38
  createResource: CreateResourceType;
22
39
  closeBuilder: CloseBuilderType;
40
+ setBreadcrumbs: SetBreadcrumbsType;
41
+ goToPatient: GoToPatientType;
23
42
  }
24
43
  export declare const publishMessage: (data: MesssageDataType) => void;
44
+ declare function subscribeMessage(type: "goToPatient", callback: (data: MessageDataMapType["goToPatient"]) => void): void;
45
+ declare function subscribeMessage(type: "setBreadcrumbs", callback: (data: MessageDataMapType["setBreadcrumbs"]) => void): void;
25
46
  declare function subscribeMessage(type: "closeBuilder", callback: (data: MessageDataMapType["closeBuilder"]) => void): void;
26
47
  declare function subscribeMessage(type: "editResource", callback: (data: MessageDataMapType["editResource"]) => void): void;
27
48
  declare function subscribeMessage(type: "createResource", callback: (data: MessageDataMapType["createResource"]) => void): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotbase/safe-frame-sync",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Typesafe iframe and parent communication between Dotstudio and Dotclinic",
5
5
  "homepage": "https://github.com/dot-base/safe-frame-sync",
6
6
  "types": "dist/index.d.ts",