@entur-partner/micro-frontend 1.0.1 → 2.1.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,47 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.1.1](https://bitbucket.org/enturas/entur-partner-packages/compare/@entur-partner/micro-frontend@2.1.0...@entur-partner/micro-frontend@2.1.1) (2022-02-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ - update to Node 16. Also update various packages to make dts-cli and its dependencies work ([93468c8](https://bitbucket.org/enturas/entur-partner-packages/commits/93468c8190e8590143f274c468df23e786af4553))
11
+
12
+ # [2.1.0](https://bitbucket.org/enturas/entur-partner-packages/compare/@entur-partner/micro-frontend@2.0.0...@entur-partner/micro-frontend@2.1.0) (2022-02-07)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **deps:** pin dependencies ([840fa3d](https://bitbucket.org/enturas/entur-partner-packages/commits/840fa3d44ce62deea2a69131d30da4d979bc8fe9))
17
+ - **deps:** pin dependencies ([0a33356](https://bitbucket.org/enturas/entur-partner-packages/commits/0a333563ff91fb711c39a45352fc31a49513ebaa))
18
+ - **deps:** update all non-major dependencies ([20fc6be](https://bitbucket.org/enturas/entur-partner-packages/commits/20fc6bed3831d05bd62ace84bc60ee48877a034c))
19
+
20
+ ### Features
21
+
22
+ - **menu provider:** add functionality to register navigate function for MF ([cb9b58d](https://bitbucket.org/enturas/entur-partner-packages/commits/cb9b58d5ccafc48195dfa8ad0b4bdca840365724))
23
+
24
+ # [2.0.0](https://bitbucket.org/enturas/entur-partner-packages/compare/@entur-partner/micro-frontend@1.1.0...@entur-partner/micro-frontend@2.0.0) (2021-11-02)
25
+
26
+ ### Reverts
27
+
28
+ - **menu:** packages was not publish to npm because of wrong npm user ([127ed33](https://bitbucket.org/enturas/entur-partner-packages/commits/127ed33e6a7e98866ec74d76ca62fa39bc5a019f))
29
+
30
+ - Merged in ETU-12948_remove_icon_from_sub_navigation_menu (pull request #29) ([6466635](https://bitbucket.org/enturas/entur-partner-packages/commits/6466635c2585ef9cffb60a0eaab74252eef19c64)), closes [#29](https://bitbucket.org/enturas/entur-partner-packages/issue/29)
31
+
32
+ ### BREAKING CHANGES
33
+
34
+ - removed icon field from MenuItem
35
+
36
+ ISSUES CLOSED: ETU-12948
37
+
38
+ Approved-by: Erik Vårdal Itland
39
+ Approved-by: Petter Sæther Moen
40
+
41
+ # [1.1.0](https://bitbucket.org/enturas/entur-partner-packages/compare/@entur-partner/micro-frontend@1.0.1...@entur-partner/micro-frontend@1.1.0) (2020-11-26)
42
+
43
+ ### Features
44
+
45
+ - add enturPartnerPermissions to User interface ([8197261](https://bitbucket.org/enturas/entur-partner-packages/commits/81972613c832c206c3ddfbd19ebc600750c54a1c))
46
+
6
47
  ## [1.0.1](https://bitbucket.org/enturas/entur-partner-packages/compare/@entur-partner/micro-frontend@1.0.0...@entur-partner/micro-frontend@1.0.1) (2020-11-23)
7
48
 
8
49
  **Note:** Version bump only for package @entur-partner/micro-frontend
package/dist/Payload.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { GetTokenSilentlyOptions } from '@auth0/auth0-spa-js';
3
2
  import { BusinessCapability } from '@entur-partner/permission-client-node';
4
3
  import { User } from './User';
@@ -13,8 +12,6 @@ export interface MenuItem {
13
12
  * is the same as the to value provided to the MenuItem
14
13
  */
15
14
  navigate: (path: string) => void;
16
- /** Optional icon from @entur/icons */
17
- icon?: React.ElementType;
18
15
  /** Is menu item disabled? */
19
16
  disabled?: boolean;
20
17
  /** Permissions required to view menu item */
@@ -23,6 +20,7 @@ export interface MenuItem {
23
20
  all?: BusinessCapability[] | BusinessCapability;
24
21
  };
25
22
  }
23
+ export declare type NavigationFunction = (to: string) => void;
26
24
  export interface MicroFrontendPayload {
27
25
  /** Logged in auth0 user */
28
26
  user: User;
@@ -37,5 +35,9 @@ export interface MicroFrontendPayload {
37
35
  /** Log the user out */
38
36
  logout: () => void;
39
37
  /** Navigate to a micro frontend or an app shell location */
40
- navigate: (to: string) => void;
38
+ navigate: NavigationFunction;
39
+ /** Set which method to be used for navigation to micro frontend routes. This
40
+ * method is used for links in navigation. If this function is not called we
41
+ * will try to use the navigate function from the first menu item instead. */
42
+ setMFNavigate: (navigate: NavigationFunction) => void;
41
43
  }
package/dist/User.d.ts CHANGED
@@ -9,4 +9,5 @@ export interface User {
9
9
  given_name: string;
10
10
  'https://entur.io/organisationID': number;
11
11
  permissions: Permission[];
12
+ enturPartnerPermissions: string[];
12
13
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { User } from './User';
2
- export { MicroFrontendPayload, MenuItem } from './Payload';
2
+ export { MicroFrontendPayload, MenuItem, NavigationFunction } from './Payload';
3
3
  export { MountEvent, UnmountEvent, createMountEvent, createUnmountEvent, MOUNT_EVENT_TYPE, UNMOUNT_EVENT_TYPE, RouteChangeEvent, ROUTE_CHANGE_EVENT_TYPE, RouteAction, } from './events';
4
4
  export { registerMicroFrontend } from './registerMicroFrontend';
@@ -5,7 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  function _inheritsLoose(subClass, superClass) {
6
6
  subClass.prototype = Object.create(superClass.prototype);
7
7
  subClass.prototype.constructor = subClass;
8
- subClass.__proto__ = superClass;
8
+
9
+ _setPrototypeOf(subClass, superClass);
9
10
  }
10
11
 
11
12
  function _getPrototypeOf(o) {
@@ -30,7 +31,7 @@ function _isNativeReflectConstruct() {
30
31
  if (typeof Proxy === "function") return true;
31
32
 
32
33
  try {
33
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
34
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
34
35
  return true;
35
36
  } catch (e) {
36
37
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"micro-frontend.cjs.development.js","sources":["../src/events.ts","../src/registerMicroFrontend.tsx"],"sourcesContent":["import { MicroFrontendPayload } from './Payload';\n\ntype MountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n payload: MicroFrontendPayload;\n};\n\ntype UnmountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n};\n\nexport const MOUNT_EVENT_TYPE = '@entur-partner:mount';\nexport const UNMOUNT_EVENT_TYPE = '@entur-partner:unmount';\n\nexport interface MountEvent extends CustomEvent<MountEventDetail> {}\nexport interface UnmountEvent extends CustomEvent<UnmountEventDetail> {}\n\nexport function createMountEvent(detail: MountEventDetail) {\n return new CustomEvent<MountEventDetail>(MOUNT_EVENT_TYPE, { detail });\n}\n\nexport function createUnmountEvent(detail: UnmountEventDetail) {\n return new CustomEvent<UnmountEventDetail>(UNMOUNT_EVENT_TYPE, { detail });\n}\n\nexport const ROUTE_CHANGE_EVENT_TYPE = '@entur-partner:after-route-change';\n\nexport type RouteAction = 'PUSH' | 'POP' | 'REPLACE';\n\ntype RouteChangeEventDetail = {\n location: Location;\n action: RouteAction;\n};\n\nexport class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {}\n","import { MicroFrontendPayload } from './Payload';\nimport {\n MountEvent,\n UnmountEvent,\n MOUNT_EVENT_TYPE,\n UNMOUNT_EVENT_TYPE,\n} from './events';\n\ninterface Config {\n microFrontendId: string;\n mount: (\n mountPoint: HTMLDivElement,\n payload: MicroFrontendPayload,\n deprecatedMountPoint: HTMLDivElement\n ) => void;\n unmount: (mountPoint: HTMLDivElement) => void;\n}\n\nexport function registerMicroFrontend(config: Config): void {\n const { unmount, microFrontendId, mount } = config;\n\n window.addEventListener(MOUNT_EVENT_TYPE, ((event: MountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n mount(\n event.detail.mountPoint,\n event.detail.payload,\n event.detail.mountPoint\n );\n }) as EventListener);\n\n window.addEventListener(UNMOUNT_EVENT_TYPE, ((event: UnmountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n unmount(event.detail.mountPoint);\n }) as EventListener);\n}\n"],"names":["MOUNT_EVENT_TYPE","UNMOUNT_EVENT_TYPE","createMountEvent","detail","CustomEvent","createUnmountEvent","ROUTE_CHANGE_EVENT_TYPE","RouteChangeEvent","registerMicroFrontend","config","unmount","microFrontendId","mount","window","addEventListener","event","id","startsWith","mountPoint","payload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaaA,gBAAgB,GAAG;IACnBC,kBAAkB,GAAG;SAKlBC,iBAAiBC;AAC/B,SAAO,IAAIC,WAAJ,CAAkCJ,gBAAlC,EAAoD;AAAEG,IAAAA,MAAM,EAANA;AAAF,GAApD,CAAP;AACD;SAEeE,mBAAmBF;AACjC,SAAO,IAAIC,WAAJ,CAAoCH,kBAApC,EAAwD;AAAEE,IAAAA,MAAM,EAANA;AAAF,GAAxD,CAAP;AACD;IAEYG,uBAAuB,GAAG;IAS1BC,gBAAb;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,iCAAsCH,WAAtC;;SClBgBI,sBAAsBC;MAC5BC,UAAoCD,OAApCC;MAASC,kBAA2BF,OAA3BE;MAAiBC,QAAUH,OAAVG;AAElCC,EAAAA,MAAM,CAACC,gBAAP,CAAwBd,gBAAxB,EAA2C,UAACe,KAAD;AACzC,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDC,IAAAA,KAAK,CACHG,KAAK,CAACZ,MAAN,CAAae,UADV,EAEHH,KAAK,CAACZ,MAAN,CAAagB,OAFV,EAGHJ,KAAK,CAACZ,MAAN,CAAae,UAHV,CAAL;AAKD,GATD;AAWAL,EAAAA,MAAM,CAACC,gBAAP,CAAwBb,kBAAxB,EAA6C,UAACc,KAAD;AAC3C,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDD,IAAAA,OAAO,CAACK,KAAK,CAACZ,MAAN,CAAae,UAAd,CAAP;AACD,GALD;AAMD;;;;;;;;;;"}
1
+ {"version":3,"file":"micro-frontend.cjs.development.js","sources":["../src/events.ts","../src/registerMicroFrontend.tsx"],"sourcesContent":["import { MicroFrontendPayload } from './Payload';\n\ntype MountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n payload: MicroFrontendPayload;\n};\n\ntype UnmountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n};\n\nexport const MOUNT_EVENT_TYPE = '@entur-partner:mount';\nexport const UNMOUNT_EVENT_TYPE = '@entur-partner:unmount';\n\nexport interface MountEvent extends CustomEvent<MountEventDetail> {}\nexport interface UnmountEvent extends CustomEvent<UnmountEventDetail> {}\n\nexport function createMountEvent(detail: MountEventDetail) {\n return new CustomEvent<MountEventDetail>(MOUNT_EVENT_TYPE, { detail });\n}\n\nexport function createUnmountEvent(detail: UnmountEventDetail) {\n return new CustomEvent<UnmountEventDetail>(UNMOUNT_EVENT_TYPE, { detail });\n}\n\nexport const ROUTE_CHANGE_EVENT_TYPE = '@entur-partner:after-route-change';\n\nexport type RouteAction = 'PUSH' | 'POP' | 'REPLACE';\n\ntype RouteChangeEventDetail = {\n location: Location;\n action: RouteAction;\n};\n\nexport class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {}\n","/*global EventListener*/\nimport { MicroFrontendPayload } from './Payload';\nimport {\n MountEvent,\n UnmountEvent,\n MOUNT_EVENT_TYPE,\n UNMOUNT_EVENT_TYPE,\n} from './events';\n\ninterface Config {\n microFrontendId: string;\n mount: (\n mountPoint: HTMLDivElement,\n payload: MicroFrontendPayload,\n deprecatedMountPoint: HTMLDivElement\n ) => void;\n unmount: (mountPoint: HTMLDivElement) => void;\n}\n\nexport function registerMicroFrontend(config: Config): void {\n const { unmount, microFrontendId, mount } = config;\n\n window.addEventListener(MOUNT_EVENT_TYPE, ((event: MountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n mount(\n event.detail.mountPoint,\n event.detail.payload,\n event.detail.mountPoint\n );\n }) as EventListener);\n\n window.addEventListener(UNMOUNT_EVENT_TYPE, ((event: UnmountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n unmount(event.detail.mountPoint);\n }) as EventListener);\n}\n"],"names":["MOUNT_EVENT_TYPE","UNMOUNT_EVENT_TYPE","createMountEvent","detail","CustomEvent","createUnmountEvent","ROUTE_CHANGE_EVENT_TYPE","RouteChangeEvent","registerMicroFrontend","config","unmount","microFrontendId","mount","window","addEventListener","event","id","startsWith","mountPoint","payload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaaA,gBAAgB,GAAG;IACnBC,kBAAkB,GAAG;SAKlBC,iBAAiBC;AAC/B,SAAO,IAAIC,WAAJ,CAAkCJ,gBAAlC,EAAoD;AAAEG,IAAAA,MAAM,EAANA;AAAF,GAApD,CAAP;AACD;SAEeE,mBAAmBF;AACjC,SAAO,IAAIC,WAAJ,CAAoCH,kBAApC,EAAwD;AAAEE,IAAAA,MAAM,EAANA;AAAF,GAAxD,CAAP;AACD;IAEYG,uBAAuB,GAAG;IAS1BC,gBAAb;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,iCAAsCH,WAAtC;;SCjBgBI,sBAAsBC;AACpC,MAAQC,OAAR,GAA4CD,MAA5C,CAAQC,OAAR;AAAA,MAAiBC,eAAjB,GAA4CF,MAA5C,CAAiBE,eAAjB;AAAA,MAAkCC,KAAlC,GAA4CH,MAA5C,CAAkCG,KAAlC;AAEAC,EAAAA,MAAM,CAACC,gBAAP,CAAwBd,gBAAxB,EAA2C,UAACe,KAAD;AACzC,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDC,IAAAA,KAAK,CACHG,KAAK,CAACZ,MAAN,CAAae,UADV,EAEHH,KAAK,CAACZ,MAAN,CAAagB,OAFV,EAGHJ,KAAK,CAACZ,MAAN,CAAae,UAHV,CAAL;AAKD,GATD;AAWAL,EAAAA,MAAM,CAACC,gBAAP,CAAwBb,kBAAxB,EAA6C,UAACc,KAAD;AAC3C,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDD,IAAAA,OAAO,CAACK,KAAK,CAACZ,MAAN,CAAae,UAAd,CAAP;AACD,GALD;AAMD;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";function t(e){return(t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}function e(t,n){return(e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function r(t,o,u){return(r=n()?Reflect.construct:function(t,n,r){var o=[null];o.push.apply(o,n);var u=new(Function.bind.apply(t,o));return r&&e(u,r.prototype),u}).apply(null,arguments)}function o(n){var u="function"==typeof Map?new Map:void 0;return(o=function(n){if(null===n||-1===Function.toString.call(n).indexOf("[native code]"))return n;if("function"!=typeof n)throw new TypeError("Super expression must either be null or a function");if(void 0!==u){if(u.has(n))return u.get(n);u.set(n,o)}function o(){return r(n,arguments,t(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),e(o,n)})(n)}Object.defineProperty(exports,"__esModule",{value:!0});var u=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r}(o(CustomEvent));exports.MOUNT_EVENT_TYPE="@entur-partner:mount",exports.ROUTE_CHANGE_EVENT_TYPE="@entur-partner:after-route-change",exports.RouteChangeEvent=u,exports.UNMOUNT_EVENT_TYPE="@entur-partner:unmount",exports.createMountEvent=function(t){return new CustomEvent("@entur-partner:mount",{detail:t})},exports.createUnmountEvent=function(t){return new CustomEvent("@entur-partner:unmount",{detail:t})},exports.registerMicroFrontend=function(t){var e=t.unmount,n=t.microFrontendId,r=t.mount;window.addEventListener("@entur-partner:mount",(function(t){t.detail.id.startsWith(n)&&r(t.detail.mountPoint,t.detail.payload,t.detail.mountPoint)})),window.addEventListener("@entur-partner:unmount",(function(t){t.detail.id.startsWith(n)&&e(t.detail.mountPoint)}))};
1
+ "use strict";function t(e){return t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function r(t,o,u){return r=n()?Reflect.construct:function(t,n,r){var o=[null];o.push.apply(o,n);var u=new(Function.bind.apply(t,o));return r&&e(u,r.prototype),u},r.apply(null,arguments)}function o(n){var u="function"==typeof Map?new Map:void 0;return o=function(n){if(null===n||-1===Function.toString.call(n).indexOf("[native code]"))return n;if("function"!=typeof n)throw new TypeError("Super expression must either be null or a function");if(void 0!==u){if(u.has(n))return u.get(n);u.set(n,o)}function o(){return r(n,arguments,t(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),e(o,n)},o(n)}Object.defineProperty(exports,"__esModule",{value:!0});var u=function(t){var n,r;function o(){return t.apply(this,arguments)||this}return r=t,(n=o).prototype=Object.create(r.prototype),n.prototype.constructor=n,e(n,r),o}(o(CustomEvent));exports.MOUNT_EVENT_TYPE="@entur-partner:mount",exports.ROUTE_CHANGE_EVENT_TYPE="@entur-partner:after-route-change",exports.RouteChangeEvent=u,exports.UNMOUNT_EVENT_TYPE="@entur-partner:unmount",exports.createMountEvent=function(t){return new CustomEvent("@entur-partner:mount",{detail:t})},exports.createUnmountEvent=function(t){return new CustomEvent("@entur-partner:unmount",{detail:t})},exports.registerMicroFrontend=function(t){var e=t.unmount,n=t.microFrontendId,r=t.mount;window.addEventListener("@entur-partner:mount",(function(t){t.detail.id.startsWith(n)&&r(t.detail.mountPoint,t.detail.payload,t.detail.mountPoint)})),window.addEventListener("@entur-partner:unmount",(function(t){t.detail.id.startsWith(n)&&e(t.detail.mountPoint)}))};
2
2
  //# sourceMappingURL=micro-frontend.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"micro-frontend.cjs.production.min.js","sources":["../src/events.ts","../src/registerMicroFrontend.tsx"],"sourcesContent":["import { MicroFrontendPayload } from './Payload';\n\ntype MountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n payload: MicroFrontendPayload;\n};\n\ntype UnmountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n};\n\nexport const MOUNT_EVENT_TYPE = '@entur-partner:mount';\nexport const UNMOUNT_EVENT_TYPE = '@entur-partner:unmount';\n\nexport interface MountEvent extends CustomEvent<MountEventDetail> {}\nexport interface UnmountEvent extends CustomEvent<UnmountEventDetail> {}\n\nexport function createMountEvent(detail: MountEventDetail) {\n return new CustomEvent<MountEventDetail>(MOUNT_EVENT_TYPE, { detail });\n}\n\nexport function createUnmountEvent(detail: UnmountEventDetail) {\n return new CustomEvent<UnmountEventDetail>(UNMOUNT_EVENT_TYPE, { detail });\n}\n\nexport const ROUTE_CHANGE_EVENT_TYPE = '@entur-partner:after-route-change';\n\nexport type RouteAction = 'PUSH' | 'POP' | 'REPLACE';\n\ntype RouteChangeEventDetail = {\n location: Location;\n action: RouteAction;\n};\n\nexport class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {}\n","import { MicroFrontendPayload } from './Payload';\nimport {\n MountEvent,\n UnmountEvent,\n MOUNT_EVENT_TYPE,\n UNMOUNT_EVENT_TYPE,\n} from './events';\n\ninterface Config {\n microFrontendId: string;\n mount: (\n mountPoint: HTMLDivElement,\n payload: MicroFrontendPayload,\n deprecatedMountPoint: HTMLDivElement\n ) => void;\n unmount: (mountPoint: HTMLDivElement) => void;\n}\n\nexport function registerMicroFrontend(config: Config): void {\n const { unmount, microFrontendId, mount } = config;\n\n window.addEventListener(MOUNT_EVENT_TYPE, ((event: MountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n mount(\n event.detail.mountPoint,\n event.detail.payload,\n event.detail.mountPoint\n );\n }) as EventListener);\n\n window.addEventListener(UNMOUNT_EVENT_TYPE, ((event: UnmountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n unmount(event.detail.mountPoint);\n }) as EventListener);\n}\n"],"names":["RouteChangeEvent","CustomEvent","detail","config","unmount","microFrontendId","mount","window","addEventListener","event","id","startsWith","mountPoint","payload"],"mappings":"gsCAoCaA,2KAAyBC,uCAvBN,uDAcO,0FAbL,2DAKDC,UACxB,IAAID,YAPmB,uBAO6B,CAAEC,OAAAA,yCAG5BA,UAC1B,IAAID,YAVqB,yBAU+B,CAAEC,OAAAA,4CCN7BC,OAC5BC,EAAoCD,EAApCC,QAASC,EAA2BF,EAA3BE,gBAAiBC,EAAUH,EAAVG,MAElCC,OAAOC,iBDRuB,wBCQa,SAACC,GACrCA,EAAMP,OAAOQ,GAAGC,WAAWN,IAGhCC,EACEG,EAAMP,OAAOU,WACbH,EAAMP,OAAOW,QACbJ,EAAMP,OAAOU,eAIjBL,OAAOC,iBDlByB,0BCkBa,SAACC,GACvCA,EAAMP,OAAOQ,GAAGC,WAAWN,IAGhCD,EAAQK,EAAMP,OAAOU"}
1
+ {"version":3,"file":"micro-frontend.cjs.production.min.js","sources":["../src/events.ts","../src/registerMicroFrontend.tsx"],"sourcesContent":["import { MicroFrontendPayload } from './Payload';\n\ntype MountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n payload: MicroFrontendPayload;\n};\n\ntype UnmountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n};\n\nexport const MOUNT_EVENT_TYPE = '@entur-partner:mount';\nexport const UNMOUNT_EVENT_TYPE = '@entur-partner:unmount';\n\nexport interface MountEvent extends CustomEvent<MountEventDetail> {}\nexport interface UnmountEvent extends CustomEvent<UnmountEventDetail> {}\n\nexport function createMountEvent(detail: MountEventDetail) {\n return new CustomEvent<MountEventDetail>(MOUNT_EVENT_TYPE, { detail });\n}\n\nexport function createUnmountEvent(detail: UnmountEventDetail) {\n return new CustomEvent<UnmountEventDetail>(UNMOUNT_EVENT_TYPE, { detail });\n}\n\nexport const ROUTE_CHANGE_EVENT_TYPE = '@entur-partner:after-route-change';\n\nexport type RouteAction = 'PUSH' | 'POP' | 'REPLACE';\n\ntype RouteChangeEventDetail = {\n location: Location;\n action: RouteAction;\n};\n\nexport class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {}\n","/*global EventListener*/\nimport { MicroFrontendPayload } from './Payload';\nimport {\n MountEvent,\n UnmountEvent,\n MOUNT_EVENT_TYPE,\n UNMOUNT_EVENT_TYPE,\n} from './events';\n\ninterface Config {\n microFrontendId: string;\n mount: (\n mountPoint: HTMLDivElement,\n payload: MicroFrontendPayload,\n deprecatedMountPoint: HTMLDivElement\n ) => void;\n unmount: (mountPoint: HTMLDivElement) => void;\n}\n\nexport function registerMicroFrontend(config: Config): void {\n const { unmount, microFrontendId, mount } = config;\n\n window.addEventListener(MOUNT_EVENT_TYPE, ((event: MountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n mount(\n event.detail.mountPoint,\n event.detail.payload,\n event.detail.mountPoint\n );\n }) as EventListener);\n\n window.addEventListener(UNMOUNT_EVENT_TYPE, ((event: UnmountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n unmount(event.detail.mountPoint);\n }) as EventListener);\n}\n"],"names":["RouteChangeEvent","CustomEvent","detail","config","unmount","microFrontendId","mount","window","addEventListener","event","id","startsWith","mountPoint","payload"],"mappings":"ysCAoCaA,oKAAyBC,uCAvBN,uDAcO,0FAbL,2DAKDC,UACxB,IAAID,YAPmB,uBAO6B,CAAEC,OAAAA,yCAG5BA,UAC1B,IAAID,YAVqB,yBAU+B,CAAEC,OAAAA,4CCL7BC,OAC5BC,EAAoCD,EAApCC,QAASC,EAA2BF,EAA3BE,gBAAiBC,EAAUH,EAAVG,MAElCC,OAAOC,iBDTuB,wBCSa,SAACC,GACrCA,EAAMP,OAAOQ,GAAGC,WAAWN,IAGhCC,EACEG,EAAMP,OAAOU,WACbH,EAAMP,OAAOW,QACbJ,EAAMP,OAAOU,eAIjBL,OAAOC,iBDnByB,0BCmBa,SAACC,GACvCA,EAAMP,OAAOQ,GAAGC,WAAWN,IAGhCD,EAAQK,EAAMP,OAAOU"}
@@ -1,7 +1,8 @@
1
1
  function _inheritsLoose(subClass, superClass) {
2
2
  subClass.prototype = Object.create(superClass.prototype);
3
3
  subClass.prototype.constructor = subClass;
4
- subClass.__proto__ = superClass;
4
+
5
+ _setPrototypeOf(subClass, superClass);
5
6
  }
6
7
 
7
8
  function _getPrototypeOf(o) {
@@ -26,7 +27,7 @@ function _isNativeReflectConstruct() {
26
27
  if (typeof Proxy === "function") return true;
27
28
 
28
29
  try {
29
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
30
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
30
31
  return true;
31
32
  } catch (e) {
32
33
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"micro-frontend.esm.js","sources":["../src/events.ts","../src/registerMicroFrontend.tsx"],"sourcesContent":["import { MicroFrontendPayload } from './Payload';\n\ntype MountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n payload: MicroFrontendPayload;\n};\n\ntype UnmountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n};\n\nexport const MOUNT_EVENT_TYPE = '@entur-partner:mount';\nexport const UNMOUNT_EVENT_TYPE = '@entur-partner:unmount';\n\nexport interface MountEvent extends CustomEvent<MountEventDetail> {}\nexport interface UnmountEvent extends CustomEvent<UnmountEventDetail> {}\n\nexport function createMountEvent(detail: MountEventDetail) {\n return new CustomEvent<MountEventDetail>(MOUNT_EVENT_TYPE, { detail });\n}\n\nexport function createUnmountEvent(detail: UnmountEventDetail) {\n return new CustomEvent<UnmountEventDetail>(UNMOUNT_EVENT_TYPE, { detail });\n}\n\nexport const ROUTE_CHANGE_EVENT_TYPE = '@entur-partner:after-route-change';\n\nexport type RouteAction = 'PUSH' | 'POP' | 'REPLACE';\n\ntype RouteChangeEventDetail = {\n location: Location;\n action: RouteAction;\n};\n\nexport class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {}\n","import { MicroFrontendPayload } from './Payload';\nimport {\n MountEvent,\n UnmountEvent,\n MOUNT_EVENT_TYPE,\n UNMOUNT_EVENT_TYPE,\n} from './events';\n\ninterface Config {\n microFrontendId: string;\n mount: (\n mountPoint: HTMLDivElement,\n payload: MicroFrontendPayload,\n deprecatedMountPoint: HTMLDivElement\n ) => void;\n unmount: (mountPoint: HTMLDivElement) => void;\n}\n\nexport function registerMicroFrontend(config: Config): void {\n const { unmount, microFrontendId, mount } = config;\n\n window.addEventListener(MOUNT_EVENT_TYPE, ((event: MountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n mount(\n event.detail.mountPoint,\n event.detail.payload,\n event.detail.mountPoint\n );\n }) as EventListener);\n\n window.addEventListener(UNMOUNT_EVENT_TYPE, ((event: UnmountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n unmount(event.detail.mountPoint);\n }) as EventListener);\n}\n"],"names":["MOUNT_EVENT_TYPE","UNMOUNT_EVENT_TYPE","createMountEvent","detail","CustomEvent","createUnmountEvent","ROUTE_CHANGE_EVENT_TYPE","RouteChangeEvent","registerMicroFrontend","config","unmount","microFrontendId","mount","window","addEventListener","event","id","startsWith","mountPoint","payload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaaA,gBAAgB,GAAG;IACnBC,kBAAkB,GAAG;SAKlBC,iBAAiBC;AAC/B,SAAO,IAAIC,WAAJ,CAAkCJ,gBAAlC,EAAoD;AAAEG,IAAAA,MAAM,EAANA;AAAF,GAApD,CAAP;AACD;SAEeE,mBAAmBF;AACjC,SAAO,IAAIC,WAAJ,CAAoCH,kBAApC,EAAwD;AAAEE,IAAAA,MAAM,EAANA;AAAF,GAAxD,CAAP;AACD;IAEYG,uBAAuB,GAAG;IAS1BC,gBAAb;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,iCAAsCH,WAAtC;;SClBgBI,sBAAsBC;MAC5BC,UAAoCD,OAApCC;MAASC,kBAA2BF,OAA3BE;MAAiBC,QAAUH,OAAVG;AAElCC,EAAAA,MAAM,CAACC,gBAAP,CAAwBd,gBAAxB,EAA2C,UAACe,KAAD;AACzC,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDC,IAAAA,KAAK,CACHG,KAAK,CAACZ,MAAN,CAAae,UADV,EAEHH,KAAK,CAACZ,MAAN,CAAagB,OAFV,EAGHJ,KAAK,CAACZ,MAAN,CAAae,UAHV,CAAL;AAKD,GATD;AAWAL,EAAAA,MAAM,CAACC,gBAAP,CAAwBb,kBAAxB,EAA6C,UAACc,KAAD;AAC3C,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDD,IAAAA,OAAO,CAACK,KAAK,CAACZ,MAAN,CAAae,UAAd,CAAP;AACD,GALD;AAMD;;;;"}
1
+ {"version":3,"file":"micro-frontend.esm.js","sources":["../src/events.ts","../src/registerMicroFrontend.tsx"],"sourcesContent":["import { MicroFrontendPayload } from './Payload';\n\ntype MountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n payload: MicroFrontendPayload;\n};\n\ntype UnmountEventDetail = {\n id: string;\n mountPoint: HTMLDivElement;\n};\n\nexport const MOUNT_EVENT_TYPE = '@entur-partner:mount';\nexport const UNMOUNT_EVENT_TYPE = '@entur-partner:unmount';\n\nexport interface MountEvent extends CustomEvent<MountEventDetail> {}\nexport interface UnmountEvent extends CustomEvent<UnmountEventDetail> {}\n\nexport function createMountEvent(detail: MountEventDetail) {\n return new CustomEvent<MountEventDetail>(MOUNT_EVENT_TYPE, { detail });\n}\n\nexport function createUnmountEvent(detail: UnmountEventDetail) {\n return new CustomEvent<UnmountEventDetail>(UNMOUNT_EVENT_TYPE, { detail });\n}\n\nexport const ROUTE_CHANGE_EVENT_TYPE = '@entur-partner:after-route-change';\n\nexport type RouteAction = 'PUSH' | 'POP' | 'REPLACE';\n\ntype RouteChangeEventDetail = {\n location: Location;\n action: RouteAction;\n};\n\nexport class RouteChangeEvent extends CustomEvent<RouteChangeEventDetail> {}\n","/*global EventListener*/\nimport { MicroFrontendPayload } from './Payload';\nimport {\n MountEvent,\n UnmountEvent,\n MOUNT_EVENT_TYPE,\n UNMOUNT_EVENT_TYPE,\n} from './events';\n\ninterface Config {\n microFrontendId: string;\n mount: (\n mountPoint: HTMLDivElement,\n payload: MicroFrontendPayload,\n deprecatedMountPoint: HTMLDivElement\n ) => void;\n unmount: (mountPoint: HTMLDivElement) => void;\n}\n\nexport function registerMicroFrontend(config: Config): void {\n const { unmount, microFrontendId, mount } = config;\n\n window.addEventListener(MOUNT_EVENT_TYPE, ((event: MountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n mount(\n event.detail.mountPoint,\n event.detail.payload,\n event.detail.mountPoint\n );\n }) as EventListener);\n\n window.addEventListener(UNMOUNT_EVENT_TYPE, ((event: UnmountEvent) => {\n if (!event.detail.id.startsWith(microFrontendId)) {\n return;\n }\n unmount(event.detail.mountPoint);\n }) as EventListener);\n}\n"],"names":["MOUNT_EVENT_TYPE","UNMOUNT_EVENT_TYPE","createMountEvent","detail","CustomEvent","createUnmountEvent","ROUTE_CHANGE_EVENT_TYPE","RouteChangeEvent","registerMicroFrontend","config","unmount","microFrontendId","mount","window","addEventListener","event","id","startsWith","mountPoint","payload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaaA,gBAAgB,GAAG;IACnBC,kBAAkB,GAAG;SAKlBC,iBAAiBC;AAC/B,SAAO,IAAIC,WAAJ,CAAkCJ,gBAAlC,EAAoD;AAAEG,IAAAA,MAAM,EAANA;AAAF,GAApD,CAAP;AACD;SAEeE,mBAAmBF;AACjC,SAAO,IAAIC,WAAJ,CAAoCH,kBAApC,EAAwD;AAAEE,IAAAA,MAAM,EAANA;AAAF,GAAxD,CAAP;AACD;IAEYG,uBAAuB,GAAG;IAS1BC,gBAAb;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,iCAAsCH,WAAtC;;SCjBgBI,sBAAsBC;AACpC,MAAQC,OAAR,GAA4CD,MAA5C,CAAQC,OAAR;AAAA,MAAiBC,eAAjB,GAA4CF,MAA5C,CAAiBE,eAAjB;AAAA,MAAkCC,KAAlC,GAA4CH,MAA5C,CAAkCG,KAAlC;AAEAC,EAAAA,MAAM,CAACC,gBAAP,CAAwBd,gBAAxB,EAA2C,UAACe,KAAD;AACzC,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDC,IAAAA,KAAK,CACHG,KAAK,CAACZ,MAAN,CAAae,UADV,EAEHH,KAAK,CAACZ,MAAN,CAAagB,OAFV,EAGHJ,KAAK,CAACZ,MAAN,CAAae,UAHV,CAAL;AAKD,GATD;AAWAL,EAAAA,MAAM,CAACC,gBAAP,CAAwBb,kBAAxB,EAA6C,UAACc,KAAD;AAC3C,QAAI,CAACA,KAAK,CAACZ,MAAN,CAAaa,EAAb,CAAgBC,UAAhB,CAA2BN,eAA3B,CAAL,EAAkD;AAChD;AACD;;AACDD,IAAAA,OAAO,CAACK,KAAK,CAACZ,MAAN,CAAae,UAAd,CAAP;AACD,GALD;AAMD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur-partner/micro-frontend",
3
- "version": "1.0.1",
3
+ "version": "2.1.1",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/micro-frontend.esm.js",
@@ -17,18 +17,18 @@
17
17
  "access": "public"
18
18
  },
19
19
  "scripts": {
20
- "watch": "tsdx watch --noClean --verbose",
21
- "build": "tsdx build",
22
- "test": "tsdx test --env=jsdom --passWithNoTests",
23
- "lint": "tsdx lint"
20
+ "watch": "dts watch --noClean --verbose",
21
+ "build": "dts build",
22
+ "test": "dts test --env=jsdom --passWithNoTests",
23
+ "lint": "dts lint"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": ">=16.8.0",
27
27
  "react-dom": ">=16.8.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@auth0/auth0-spa-js": "^1.8.1",
31
- "@entur-partner/permission-client-node": "^1.1.3"
30
+ "@auth0/auth0-spa-js": "1.13.6",
31
+ "@entur-partner/permission-client-node": "1.1.3"
32
32
  },
33
33
  "jest": {
34
34
  "collectCoverageFrom": [
@@ -40,5 +40,5 @@
40
40
  "reportFile": "jest-sonar-report.xml",
41
41
  "indent": 4
42
42
  },
43
- "gitHead": "605060b3dd6a7d0efe8c2be370abe8f3c8e8b240"
43
+ "gitHead": "ba34d91c553fbd985db00d3c8a4ea4d4dca75564"
44
44
  }