@onecx/integration-interface 3.2.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/README.md +11 -0
- package/package.json +15 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +9 -0
- package/src/index.js.map +1 -0
- package/src/lib/topics/current-mfe/v1/current-mfe.topic.d.ts +5 -0
- package/src/lib/topics/current-mfe/v1/current-mfe.topic.js +11 -0
- package/src/lib/topics/current-mfe/v1/current-mfe.topic.js.map +1 -0
- package/src/lib/topics/current-mfe/v1/mfe-info.model.d.ts +9 -0
- package/src/lib/topics/current-mfe/v1/mfe-info.model.js +3 -0
- package/src/lib/topics/current-mfe/v1/mfe-info.model.js.map +1 -0
- package/src/lib/topics/current-page/v1/current-page.topic.d.ts +12 -0
- package/src/lib/topics/current-page/v1/current-page.topic.js +33 -0
- package/src/lib/topics/current-page/v1/current-page.topic.js.map +1 -0
- package/src/lib/topics/current-page/v1/page-info.model.d.ts +7 -0
- package/src/lib/topics/current-page/v1/page-info.model.js +3 -0
- package/src/lib/topics/current-page/v1/page-info.model.js.map +1 -0
- package/src/lib/topics/current-theme/v1/current-theme.topic.d.ts +5 -0
- package/src/lib/topics/current-theme/v1/current-theme.topic.js +11 -0
- package/src/lib/topics/current-theme/v1/current-theme.topic.js.map +1 -0
- package/src/lib/topics/current-theme/v1/theme.model.d.ts +16 -0
- package/src/lib/topics/current-theme/v1/theme.model.js +3 -0
- package/src/lib/topics/current-theme/v1/theme.model.js.map +1 -0
- package/src/lib/topics/global-error/v1/global-error.topic.d.ts +4 -0
- package/src/lib/topics/global-error/v1/global-error.topic.js +11 -0
- package/src/lib/topics/global-error/v1/global-error.topic.js.map +1 -0
- package/src/lib/topics/global-loading/v1/global-loading.topic.d.ts +4 -0
- package/src/lib/topics/global-loading/v1/global-loading.topic.js +11 -0
- package/src/lib/topics/global-loading/v1/global-loading.topic.js.map +1 -0
package/README.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# integration-interface
|
2
|
+
|
3
|
+
This library contains everything that is needed to communicate with the shell and that is framework independent
|
4
|
+
|
5
|
+
## Building
|
6
|
+
|
7
|
+
Run `nx build integration-interface` to build the library.
|
8
|
+
|
9
|
+
## Running unit tests
|
10
|
+
|
11
|
+
Run `nx test integration-interface` to execute the unit tests via [Jest](https://jestjs.io).
|
package/package.json
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "@onecx/integration-interface",
|
3
|
+
"version": "3.2.1",
|
4
|
+
"peerDependencies": {
|
5
|
+
"tslib": "^2.3.0",
|
6
|
+
"rxjs": "7.8.1",
|
7
|
+
"@onecx/accelerator": "^3"
|
8
|
+
},
|
9
|
+
"type": "commonjs",
|
10
|
+
"main": "./src/index.js",
|
11
|
+
"typings": "./src/index.d.ts",
|
12
|
+
"publishConfig": {
|
13
|
+
"access": "public"
|
14
|
+
}
|
15
|
+
}
|
package/src/index.d.ts
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
export * from './lib/topics/current-mfe/v1/current-mfe.topic';
|
2
|
+
export * from './lib/topics/current-page/v1/current-page.topic';
|
3
|
+
export * from './lib/topics/global-error/v1/global-error.topic';
|
4
|
+
export * from './lib/topics/global-loading/v1/global-loading.topic';
|
5
|
+
export * from './lib/topics/current-theme/v1/current-theme.topic';
|
package/src/index.js
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./lib/topics/current-mfe/v1/current-mfe.topic"), exports);
|
5
|
+
tslib_1.__exportStar(require("./lib/topics/current-page/v1/current-page.topic"), exports);
|
6
|
+
tslib_1.__exportStar(require("./lib/topics/global-error/v1/global-error.topic"), exports);
|
7
|
+
tslib_1.__exportStar(require("./lib/topics/global-loading/v1/global-loading.topic"), exports);
|
8
|
+
tslib_1.__exportStar(require("./lib/topics/current-theme/v1/current-theme.topic"), exports);
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/index.ts"],"names":[],"mappings":";;;AAAA,wFAA6D;AAC7D,0FAA+D;AAC/D,0FAA+D;AAC/D,8FAAmE;AACnE,4FAAiE"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CurrentMfeTopic = void 0;
|
4
|
+
const accelerator_1 = require("@onecx/accelerator");
|
5
|
+
class CurrentMfeTopic extends accelerator_1.Topic {
|
6
|
+
constructor() {
|
7
|
+
super('currentMfe', 1);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.CurrentMfeTopic = CurrentMfeTopic;
|
11
|
+
//# sourceMappingURL=current-mfe.topic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"current-mfe.topic.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/current-mfe/v1/current-mfe.topic.ts"],"names":[],"mappings":";;;AAAA,oDAA0C;AAG1C,MAAa,eAAgB,SAAQ,mBAAc;IACjD;QACE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACxB,CAAC;CACF;AAJD,0CAIC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mfe-info.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/current-mfe/v1/mfe-info.model.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Topic } from '@onecx/accelerator';
|
2
|
+
import { PageInfo } from './page-info.model';
|
3
|
+
/**
|
4
|
+
* This topic will only fire when pageInfo.path matches document.location.pathname,
|
5
|
+
* if not it will fire undefined.
|
6
|
+
*/
|
7
|
+
export declare class CurrentPageTopic extends Topic<PageInfo | undefined> {
|
8
|
+
private currentPath$;
|
9
|
+
constructor();
|
10
|
+
asObservable(): import("rxjs").Observable<PageInfo | undefined>;
|
11
|
+
private watchForPathChanges;
|
12
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CurrentPageTopic = void 0;
|
4
|
+
const accelerator_1 = require("@onecx/accelerator");
|
5
|
+
const rxjs_1 = require("rxjs");
|
6
|
+
const BehaviorSubject_1 = require("rxjs/internal/BehaviorSubject");
|
7
|
+
/**
|
8
|
+
* This topic will only fire when pageInfo.path matches document.location.pathname,
|
9
|
+
* if not it will fire undefined.
|
10
|
+
*/
|
11
|
+
class CurrentPageTopic extends accelerator_1.Topic {
|
12
|
+
currentPath$ = new BehaviorSubject_1.BehaviorSubject(document.location.pathname);
|
13
|
+
constructor() {
|
14
|
+
super('currentPage', 1);
|
15
|
+
this.watchForPathChanges();
|
16
|
+
}
|
17
|
+
asObservable() {
|
18
|
+
return (0, rxjs_1.combineLatest)([super.asObservable(), this.currentPath$.pipe((0, rxjs_1.distinctUntilChanged)())]).pipe((0, rxjs_1.map)(([v, path]) => (v.path === path ? v : undefined)));
|
19
|
+
}
|
20
|
+
watchForPathChanges() {
|
21
|
+
const body = document.querySelector('body');
|
22
|
+
if (body === null) {
|
23
|
+
console.error('could not listen to location changes');
|
24
|
+
throw new Error('could not listen to location changes');
|
25
|
+
}
|
26
|
+
const observer = new MutationObserver(() => {
|
27
|
+
this.currentPath$.next(document.location.pathname);
|
28
|
+
});
|
29
|
+
observer.observe(body, { childList: true, subtree: true });
|
30
|
+
}
|
31
|
+
}
|
32
|
+
exports.CurrentPageTopic = CurrentPageTopic;
|
33
|
+
//# sourceMappingURL=current-page.topic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"current-page.topic.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/current-page/v1/current-page.topic.ts"],"names":[],"mappings":";;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":"page-info.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/current-page/v1/page-info.model.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CurrentThemeTopic = void 0;
|
4
|
+
const accelerator_1 = require("@onecx/accelerator");
|
5
|
+
class CurrentThemeTopic extends accelerator_1.Topic {
|
6
|
+
constructor() {
|
7
|
+
super('currentTheme', 1);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.CurrentThemeTopic = CurrentThemeTopic;
|
11
|
+
//# sourceMappingURL=current-theme.topic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"current-theme.topic.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/current-theme/v1/current-theme.topic.ts"],"names":[],"mappings":";;;AAAA,oDAA0C;AAG1C,MAAa,iBAAkB,SAAQ,mBAAY;IACjD;QACE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAC1B,CAAC;CACF;AAJD,8CAIC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export interface Theme {
|
2
|
+
id?: string;
|
3
|
+
assetsUpdateDate?: string;
|
4
|
+
assetsUrl?: string;
|
5
|
+
logoUrl?: string;
|
6
|
+
faviconUrl?: string;
|
7
|
+
cssFile?: string;
|
8
|
+
description?: string;
|
9
|
+
name?: string;
|
10
|
+
previewImageUrl?: string;
|
11
|
+
properties?: {
|
12
|
+
[key: string]: {
|
13
|
+
[key: string]: string;
|
14
|
+
};
|
15
|
+
};
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"theme.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/current-theme/v1/theme.model.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GlobalErrorTopic = void 0;
|
4
|
+
const accelerator_1 = require("@onecx/accelerator");
|
5
|
+
class GlobalErrorTopic extends accelerator_1.Topic {
|
6
|
+
constructor() {
|
7
|
+
super('globalError', 1);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.GlobalErrorTopic = GlobalErrorTopic;
|
11
|
+
//# sourceMappingURL=global-error.topic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"global-error.topic.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/global-error/v1/global-error.topic.ts"],"names":[],"mappings":";;;AAAA,oDAA0C;AAE1C,MAAa,gBAAiB,SAAQ,mBAAa;IACjD;QACE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;IACzB,CAAC;CACF;AAJD,4CAIC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GlobalLoadingTopic = void 0;
|
4
|
+
const accelerator_1 = require("@onecx/accelerator");
|
5
|
+
class GlobalLoadingTopic extends accelerator_1.Topic {
|
6
|
+
constructor() {
|
7
|
+
super('globalLoading', 1);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.GlobalLoadingTopic = GlobalLoadingTopic;
|
11
|
+
//# sourceMappingURL=global-loading.topic.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"global-loading.topic.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/global-loading/v1/global-loading.topic.ts"],"names":[],"mappings":";;;AAAA,oDAA0C;AAE1C,MAAa,kBAAmB,SAAQ,mBAAc;IACpD;QACE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC,CAAA;IAC3B,CAAC;CACF;AAJD,gDAIC"}
|