@dotbase/safe-frame-sync 1.2.0 → 1.2.2

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
@@ -42,22 +42,21 @@ npm add @dotbase/safe-frame-sync
42
42
 
43
43
  The package provides two essential functions:
44
44
 
45
- * `publishMessage` for sending typed messages
46
- * `subscribeMessage` for listening to specific typed messages
45
+ - `publishMessage` for sending typed messages
46
+ - `subscribeMessage` for listening to specific typed messages
47
47
 
48
48
  ### Message Types
49
49
 
50
50
  ### In Parent
51
51
 
52
52
  ```ts
53
- import { subscribeMessage } from "@dotbase/safe-frame-sync"
53
+ import { subscribeMessage } from "@dotbase/safe-frame-sync";
54
54
 
55
55
  // Somewhere in your code
56
56
  subscribeMessage("createResource", (data) => {
57
- // Your callback implementation with type-safe data
58
- console.log(data)
59
- })
60
-
57
+ // Your callback implementation with type-safe data
58
+ console.log(data);
59
+ });
61
60
  ```
62
61
 
63
62
  ### In Iframe
@@ -73,3 +72,11 @@ publishMessage({
73
72
  workflowType: "document";
74
73
  })
75
74
  ```
75
+
76
+ ## Release Process
77
+
78
+ We are using [Semantic Release](https://semantic-release.gitbook.io/semantic-release) and Github Actions to build and publish a new version of this package, whenever we merge something on the `main` branch.
79
+
80
+ We do not rely on a `NPM_TOKEN` as this is phased out by NPM. Instead we use [Trusted Publishing](https://www.npmjs.com/package/@dotbase/safe-frame-sync/access), which is set up between our npm package and this repository and the publishing Github Action.
81
+
82
+ See `.github/workflows/semantic-release.yml` for the detailed implementation and the [`@dotbase/safe-frame-sync` npm package settings](https://www.npmjs.com/package/@dotbase/safe-frame-sync/access) for the Trusted Publishing settings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotbase/safe-frame-sync",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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",
@@ -10,24 +10,35 @@
10
10
  "main": "./dist/index.umd.js",
11
11
  "module": "./dist/index.es.js",
12
12
  "type": "module",
13
+ "engines": {
14
+ "node": ">=24.11.0"
15
+ },
13
16
  "scripts": {
14
17
  "dev": "vite",
15
18
  "build": "tsc && vite build",
16
- "preview": "vite preview"
19
+ "preview": "vite preview",
20
+ "prettier:ci": "prettier --check .",
21
+ "prettier:fix": "prettier --write --list-different .",
22
+ "lint": "eslint . ",
23
+ "lint:ci": "npm run lint && npm run prettier:ci",
24
+ "lint:fix": "npm run prettier:fix && eslint . --fix",
25
+ "test:unit": "vitest dev",
26
+ "test:ci": "vitest run",
27
+ "typecheck": "tsc --noEmit --incremental --tsBuildInfoFile .cache/tsbuildinfo"
17
28
  },
18
29
  "devDependencies": {
19
- "@typescript-eslint/eslint-plugin": "^6.21.0",
20
- "eslint": "^8.57.0",
21
- "eslint-config-prettier": "^9.1.0",
22
- "eslint-config-standard-with-typescript": "^43.0.1",
23
- "eslint-plugin-import": "^2.29.1",
24
- "eslint-plugin-n": "^16.6.2",
25
- "eslint-plugin-promise": "^6.2.0",
26
- "globals": "^15.3.0",
27
- "prettier": "3.2.5",
28
- "typescript": "^5.4.5",
29
- "vite": "^5.2.0",
30
- "vite-plugin-dts": "^3.9.1"
30
+ "@eslint/js": "^9.39.1",
31
+ "@types/node": "^24.10.0",
32
+ "eslint": "^9.39.1",
33
+ "eslint-config-prettier": "^10.1.8",
34
+ "globals": "^16.5.0",
35
+ "jsdom": "^27.1.0",
36
+ "prettier": "3.6.2",
37
+ "typescript": "^5.9.3",
38
+ "vitest": "^4.0.8",
39
+ "typescript-eslint": "^8.46.3",
40
+ "vite": "^7.2.2",
41
+ "vite-plugin-dts": "^4.5.4"
31
42
  },
32
43
  "repository": {
33
44
  "type": "git",
@@ -38,4 +49,4 @@
38
49
  "bugs": {
39
50
  "url": "https://github.com/dot-base/safe-frame-sync/issues"
40
51
  }
41
- }
52
+ }
package/dist/index.d.ts DELETED
@@ -1,50 +0,0 @@
1
- export type MessageType = "editResource" | "createResource" | "closeBuilder" | "setBreadcrumbs" | "goToPatient" | "iframeRouteChange";
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
- }
12
- export interface EditResourceType {
13
- type: "editResource";
14
- resourceId: string;
15
- resourceName: string;
16
- workflowType: WorkflowType;
17
- }
18
- export interface CreateResourceType {
19
- type: "createResource";
20
- resourceId: string;
21
- resourceName: string;
22
- workflowType: WorkflowType;
23
- }
24
- export interface CloseBuilderType {
25
- type: "closeBuilder";
26
- }
27
- export interface SetBreadcrumbsType {
28
- type: "setBreadcrumbs";
29
- breadcrumbs: BreadcrumbsType;
30
- }
31
- export interface GoToPatientType {
32
- type: "goToPatient";
33
- patientId: string;
34
- }
35
- export interface IframeRouteChangeType {
36
- type: "iframeRouteChange";
37
- path: string;
38
- }
39
- export type MesssageDataType = EditResourceType | CreateResourceType | CloseBuilderType | SetBreadcrumbsType | GoToPatientType | IframeRouteChangeType;
40
- export interface MessageDataMapType {
41
- editResource: EditResourceType;
42
- createResource: CreateResourceType;
43
- closeBuilder: CloseBuilderType;
44
- setBreadcrumbs: SetBreadcrumbsType;
45
- goToPatient: GoToPatientType;
46
- iframeRouteChange: IframeRouteChangeType;
47
- }
48
- export declare const publishMessage: (data: MesssageDataType, target?: Window) => void;
49
- declare function subscribeMessage<T extends MessageType>(type: T, callback: (data: MessageDataMapType[T]) => void): void;
50
- export { subscribeMessage };
package/dist/index.es.js DELETED
@@ -1,13 +0,0 @@
1
- const i = (e, o) => {
2
- var s;
3
- o !== void 0 && o.postMessage(e, "*"), (s = window.top) == null || s.postMessage(e, "*");
4
- };
5
- function n(e, o) {
6
- window.onmessage = function(s) {
7
- s.data.type === e && o(s.data);
8
- };
9
- }
10
- export {
11
- i as publishMessage,
12
- n as subscribeMessage
13
- };
package/dist/index.umd.js DELETED
@@ -1 +0,0 @@
1
- (function(e,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(e=typeof globalThis<"u"?globalThis:e||self,s(e["safe-frame-sync"]={}))})(this,function(e){"use strict";const s=(n,o)=>{var i;o!==void 0&&o.postMessage(n,"*"),(i=window.top)==null||i.postMessage(n,"*")};function t(n,o){window.onmessage=function(i){i.data.type===n&&o(i.data)}}e.publishMessage=s,e.subscribeMessage=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});