@servicetitan/web-components 14.2.0 → 16.0.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/dist/common.d.ts +23 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +99 -1
- package/dist/common.js.map +1 -1
- package/dist/history-manager.d.ts +11 -0
- package/dist/history-manager.d.ts.map +1 -0
- package/dist/history-manager.js +88 -0
- package/dist/history-manager.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +5 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +99 -58
- package/dist/loader.js.map +1 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +18 -4
- package/dist/register.js.map +1 -1
- package/package.json +12 -9
- package/src/common.ts +81 -0
- package/src/history-manager.ts +75 -0
- package/src/index.ts +1 -1
- package/src/loader.tsx +174 -91
- package/src/register.tsx +29 -8
- package/dist/is-web-component-context.d.ts +0 -3
- package/dist/is-web-component-context.d.ts.map +0 -1
- package/dist/is-web-component-context.js +0 -6
- package/dist/is-web-component-context.js.map +0 -1
- package/src/is-web-component-context.ts +0 -3
package/dist/common.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Log } from '@servicetitan/log-service';
|
|
2
|
+
import { HistoryManager } from './history-manager';
|
|
2
3
|
export declare const BASENAME_TOKEN: import("@servicetitan/react-ioc").SymbolToken<string>;
|
|
4
|
+
export declare const IS_WEB_COMPONENT_TOKEN: import("@servicetitan/react-ioc").SymbolToken<boolean>;
|
|
5
|
+
export declare const RENDER_ROOT_TOKEN: import("@servicetitan/react-ioc").SymbolToken<ShadowRoot>;
|
|
3
6
|
export interface Entries {
|
|
4
7
|
logService?: Log;
|
|
8
|
+
historyManager?: HistoryManager;
|
|
9
|
+
eventBus?: EventBus;
|
|
5
10
|
basename?: string;
|
|
6
11
|
onReady: () => void;
|
|
7
12
|
}
|
|
@@ -9,4 +14,22 @@ export interface IWebComponent {
|
|
|
9
14
|
provide(entries: Entries): void;
|
|
10
15
|
}
|
|
11
16
|
export declare function isCompatible(hostVersion: string, packageVersion: string): boolean;
|
|
17
|
+
interface GetJsonOptions extends RequestInit {
|
|
18
|
+
retries?: number;
|
|
19
|
+
retryDelay?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function getJson<T = any>(url: string, { retries, retryDelay, ...config }?: GetJsonOptions): Promise<{
|
|
22
|
+
data: T;
|
|
23
|
+
headers: Headers;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function useCancelation(): AbortController;
|
|
26
|
+
export declare type EventHandler = () => void;
|
|
27
|
+
export declare class EventBus {
|
|
28
|
+
private emitter;
|
|
29
|
+
on: (type: string, handler: EventHandler) => void;
|
|
30
|
+
off: (type: string, handler: EventHandler) => void;
|
|
31
|
+
emit: (type: string) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function useEventBus(): EventBus;
|
|
34
|
+
export {};
|
|
12
35
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,cAAc,uDAAwC,CAAC;AACpE,eAAO,MAAM,sBAAsB,wDAAiD,CAAC;AACrF,eAAO,MAAM,iBAAiB,2DAA+C,CAAC;AAE9E,MAAM,WAAW,OAAO;IACpB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAkCvE;AAED,UAAU,cAAe,SAAQ,WAAW;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,OAAO,CAAC,CAAC,GAAG,GAAG,EACjC,GAAG,EAAE,MAAM,EACX,EAAE,OAAW,EAAE,UAAiB,EAAE,GAAG,MAAM,EAAE,GAAE,cAAmB,GACnE,OAAO,CAAC;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAmCxC;AAED,wBAAgB,cAAc,oBAE7B;AAED,oBAAY,YAAY,GAAG,MAAM,IAAI,CAAC;AAEtC,qBAAa,QAAQ;IACjB,OAAO,CAAC,OAAO,CAAU;IAEzB,EAAE,SAAU,MAAM,WAAW,YAAY,UAEvC;IAEF,GAAG,SAAU,MAAM,WAAW,YAAY,UAExC;IAEF,IAAI,SAAU,MAAM,UAElB;CACL;AAED,wBAAgB,WAAW,aAE1B"}
|
package/dist/common.js
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
2
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isCompatible = exports.BASENAME_TOKEN = void 0;
|
|
26
|
+
exports.useEventBus = exports.EventBus = exports.useCancelation = exports.getJson = exports.isCompatible = exports.RENDER_ROOT_TOKEN = exports.IS_WEB_COMPONENT_TOKEN = exports.BASENAME_TOKEN = void 0;
|
|
7
27
|
const semver_1 = __importDefault(require("semver"));
|
|
28
|
+
const mitt_1 = __importDefault(require("mitt"));
|
|
29
|
+
const react_1 = require("react");
|
|
8
30
|
const react_ioc_1 = require("@servicetitan/react-ioc");
|
|
9
31
|
exports.BASENAME_TOKEN = react_ioc_1.symbolToken('BASENAME_TOKEN');
|
|
32
|
+
exports.IS_WEB_COMPONENT_TOKEN = react_ioc_1.symbolToken('IS_WEB_COMPONENT_TOKEN');
|
|
33
|
+
exports.RENDER_ROOT_TOKEN = react_ioc_1.symbolToken('RENDER_ROOT_TOKEN');
|
|
10
34
|
function isCompatible(hostVersion, packageVersion) {
|
|
11
35
|
if (hostVersion === packageVersion) {
|
|
12
36
|
return true;
|
|
@@ -36,4 +60,78 @@ function isCompatible(hostVersion, packageVersion) {
|
|
|
36
60
|
return false;
|
|
37
61
|
}
|
|
38
62
|
exports.isCompatible = isCompatible;
|
|
63
|
+
function getJson(url, _a = {}) {
|
|
64
|
+
var { retries = 5, retryDelay = 1000 } = _a, config = __rest(_a, ["retries", "retryDelay"]);
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
let response;
|
|
67
|
+
try {
|
|
68
|
+
response = yield fetch(url, config);
|
|
69
|
+
}
|
|
70
|
+
catch (_b) {
|
|
71
|
+
if (retries > 0) {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
const { signal } = config;
|
|
74
|
+
const timeoutId = window.setTimeout(() => {
|
|
75
|
+
getJson(url, Object.assign(Object.assign({}, config), { retries: retries - 1, retryDelay: retryDelay * 4 })).then(resolve, reject);
|
|
76
|
+
}, retryDelay);
|
|
77
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', () => window.clearTimeout(timeoutId));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`Failed to fetch: "${url}".`);
|
|
81
|
+
}
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
let message = `Requesting "${url}" failed with status code ${response.status}.`;
|
|
84
|
+
try {
|
|
85
|
+
message += ` Details: ${yield response.text()}.`;
|
|
86
|
+
}
|
|
87
|
+
catch (_c) { } // eslint-disable-line no-empty
|
|
88
|
+
throw new Error(message);
|
|
89
|
+
}
|
|
90
|
+
return { data: yield response.json(), headers: response.headers };
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.getJson = getJson;
|
|
94
|
+
function useCancelation() {
|
|
95
|
+
return react_1.useRef(new AbortController()).current;
|
|
96
|
+
}
|
|
97
|
+
exports.useCancelation = useCancelation;
|
|
98
|
+
class EventBus {
|
|
99
|
+
constructor() {
|
|
100
|
+
Object.defineProperty(this, "emitter", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
configurable: true,
|
|
103
|
+
writable: true,
|
|
104
|
+
value: mitt_1.default()
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(this, "on", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true,
|
|
110
|
+
value: (type, handler) => {
|
|
111
|
+
this.emitter.on(type, handler);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(this, "off", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
configurable: true,
|
|
117
|
+
writable: true,
|
|
118
|
+
value: (type, handler) => {
|
|
119
|
+
this.emitter.off(type, handler);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(this, "emit", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
configurable: true,
|
|
125
|
+
writable: true,
|
|
126
|
+
value: (type) => {
|
|
127
|
+
this.emitter.emit(type);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.EventBus = EventBus;
|
|
133
|
+
function useEventBus() {
|
|
134
|
+
return react_1.useRef(new EventBus()).current;
|
|
135
|
+
}
|
|
136
|
+
exports.useEventBus = useEventBus;
|
|
39
137
|
//# sourceMappingURL=common.js.map
|
package/dist/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,gDAAwB;AAExB,iCAA+B;AAE/B,uDAAsD;AAKzC,QAAA,cAAc,GAAG,uBAAW,CAAS,gBAAgB,CAAC,CAAC;AACvD,QAAA,sBAAsB,GAAG,uBAAW,CAAU,wBAAwB,CAAC,CAAC;AACxE,QAAA,iBAAiB,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;IAArB;QACI;;;;mBAAkB,cAAI,EAAE;WAAC;QAEzB;;;;mBAAK,CAAC,IAAY,EAAE,OAAqB,EAAE,EAAE;gBACzC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,CAAC;WAAC;QAEF;;;;mBAAM,CAAC,IAAY,EAAE,OAAqB,EAAE,EAAE;gBAC1C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpC,CAAC;WAAC;QAEF;;;;mBAAO,CAAC,IAAY,EAAE,EAAE;gBACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;WAAC;IACN,CAAC;CAAA;AAdD,4BAcC;AAED,SAAgB,WAAW;IACvB,OAAO,cAAM,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC;AAC1C,CAAC;AAFD,kCAEC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { History, Location, UnregisterCallback } from 'history';
|
|
2
|
+
export declare class HistoryManager {
|
|
3
|
+
occupied?: {
|
|
4
|
+
history: History;
|
|
5
|
+
location: Location;
|
|
6
|
+
};
|
|
7
|
+
storage: Map<History<unknown>, UnregisterCallback>;
|
|
8
|
+
register: (addable: History) => void;
|
|
9
|
+
unregister: (removable: History) => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=history-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-manager.d.ts","sourceRoot":"","sources":["../src/history-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIhE,qBACa,cAAc;IAEvB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;IAEpD,OAAO,4CAA0C;IAEjD,QAAQ,YAAa,OAAO,UAuD1B;IAEF,UAAU,cAAe,OAAO,UAK9B;CACL"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.HistoryManager = void 0;
|
|
10
|
+
const react_ioc_1 = require("@servicetitan/react-ioc");
|
|
11
|
+
let HistoryManager = class HistoryManager {
|
|
12
|
+
constructor() {
|
|
13
|
+
// Initiator of action, used for filtering redirections
|
|
14
|
+
Object.defineProperty(this, "occupied", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "storage", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: new Map()
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "register", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: (addable) => {
|
|
31
|
+
this.storage.set(addable, addable.listen(location => {
|
|
32
|
+
const path = addable.createHref(location);
|
|
33
|
+
const state = location.state;
|
|
34
|
+
if (!this.occupied) {
|
|
35
|
+
this.occupied = { history: addable, location };
|
|
36
|
+
}
|
|
37
|
+
else if (this.occupied.history === addable) {
|
|
38
|
+
this.occupied.location = location;
|
|
39
|
+
}
|
|
40
|
+
for (const history of this.storage.keys()) {
|
|
41
|
+
if (history === addable) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (history.createHref(history.location) === path &&
|
|
45
|
+
history.location.state === state) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
// Allow redirects only to the deeper pages
|
|
49
|
+
const unblock = history.block(location => {
|
|
50
|
+
if (this.occupied &&
|
|
51
|
+
!history
|
|
52
|
+
.createHref(location)
|
|
53
|
+
.startsWith(this.occupied.history.createHref(this.occupied.location))) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
history.replace(path, state);
|
|
58
|
+
unblock();
|
|
59
|
+
}
|
|
60
|
+
// Wait for all updates, including redirections
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
if (((_a = this.occupied) === null || _a === void 0 ? void 0 : _a.history) === addable &&
|
|
64
|
+
((_b = this.occupied) === null || _b === void 0 ? void 0 : _b.location) === location) {
|
|
65
|
+
this.occupied = undefined;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(this, "unregister", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: (removable) => {
|
|
76
|
+
if (this.storage.has(removable)) {
|
|
77
|
+
this.storage.get(removable)();
|
|
78
|
+
this.storage.delete(removable);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
HistoryManager = __decorate([
|
|
85
|
+
react_ioc_1.injectable()
|
|
86
|
+
], HistoryManager);
|
|
87
|
+
exports.HistoryManager = HistoryManager;
|
|
88
|
+
//# sourceMappingURL=history-manager.js.map
|
|
@@ -0,0 +1 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,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC3D,EACP;gCACE,OAAO,KAAK,CAAC;6BAChB;wBACL,CAAC,CAAC,CAAC;wBAEH,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;wBAE7B,OAAO,EAAE,CAAC;qBACb;oBAED,+CAA+C;oBAC/C,UAAU,CAAC,GAAG,EAAE;;wBACZ,IACI,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,MAAK,OAAO;4BAClC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,MAAK,QAAQ,EACtC;4BACE,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;yBAC7B;oBACL,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CACL,CAAC;YACN,CAAC;WAAC;QAEF;;;;mBAAa,CAAC,SAAkB,EAAE,EAAE;gBAChC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;oBAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAE,EAAE,CAAC;oBAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;iBAClC;YACL,CAAC;WAAC;IACN,CAAC;CAAA,CAAA;AArEY,cAAc;IAD1B,sBAAU,EAAE;GACA,cAAc,CAqE1B;AArEY,wCAAc"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./common"), exports);
|
|
14
|
-
__exportStar(require("./
|
|
14
|
+
__exportStar(require("./history-manager"), exports);
|
|
15
15
|
__exportStar(require("./register"), exports);
|
|
16
16
|
__exportStar(require("./loader"), exports);
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,oDAAkC;AAClC,6CAA2B;AAC3B,2CAAyB"}
|
package/dist/loader.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
declare global {
|
|
3
3
|
export const EXPOSED_DEPENDENCIES: Record<string, {
|
|
4
4
|
version: string;
|
|
5
5
|
variable: string;
|
|
6
6
|
}>;
|
|
7
7
|
}
|
|
8
|
+
export interface LoaderRef {
|
|
9
|
+
emit(type: string): void;
|
|
10
|
+
}
|
|
8
11
|
export interface LoaderProps {
|
|
9
12
|
src: string;
|
|
10
13
|
data?: Record<string, string>;
|
|
@@ -12,5 +15,5 @@ export interface LoaderProps {
|
|
|
12
15
|
fallback?: JSX.Element;
|
|
13
16
|
className?: string;
|
|
14
17
|
}
|
|
15
|
-
export declare const Loader:
|
|
18
|
+
export declare const Loader: import("react").ForwardRefExoticComponent<LoaderProps & import("react").RefAttributes<LoaderRef>>;
|
|
16
19
|
//# sourceMappingURL=loader.d.ts.map
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.tsx"],"names":[],"mappings":";AAmBA,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,CAAC,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5F;AA0DD,MAAM,WAAW,SAAS;IACtB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,MAAM,mGAsIlB,CAAC"}
|
package/dist/loader.js
CHANGED
|
@@ -16,10 +16,21 @@ const error_boundary_1 = require("@servicetitan/error-boundary");
|
|
|
16
16
|
const log_service_1 = require("@servicetitan/log-service");
|
|
17
17
|
const react_ioc_1 = require("@servicetitan/react-ioc");
|
|
18
18
|
const common_1 = require("./common");
|
|
19
|
-
|
|
19
|
+
const history_manager_1 = require("./history-manager");
|
|
20
|
+
function omitPackageVersion(packageUrl) {
|
|
21
|
+
const chunks = packageUrl.split('@');
|
|
22
|
+
if (chunks.length > 2) {
|
|
23
|
+
return chunks.slice(0, -1).join('@');
|
|
24
|
+
}
|
|
25
|
+
return packageUrl;
|
|
26
|
+
}
|
|
27
|
+
function getBundleInfo(packageUrl, signal) {
|
|
20
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const { dependencies, name } = yield (
|
|
22
|
-
const
|
|
29
|
+
const { data: { dependencies, name, version }, headers, } = yield common_1.getJson(`${packageUrl}/package.json`, { cache: 'no-store', signal });
|
|
30
|
+
const exactPackageUrl = headers.get('X-Delivered-By') === 'unpkg'
|
|
31
|
+
? `${omitPackageVersion(packageUrl)}@${version}`
|
|
32
|
+
: packageUrl;
|
|
33
|
+
const { data: metadata } = yield common_1.getJson(`${exactPackageUrl}/dist/metadata.json`, { signal });
|
|
23
34
|
const mismatch = Object.entries(EXPOSED_DEPENDENCIES).reduce((result, [dependency, { version: hostVersion }]) => {
|
|
24
35
|
const packageVersion = dependencies[dependency];
|
|
25
36
|
if (packageVersion && !common_1.isCompatible(hostVersion, packageVersion)) {
|
|
@@ -38,69 +49,99 @@ function getBundleInfo(packageUrl) {
|
|
|
38
49
|
}
|
|
39
50
|
const hasMismatch = !!Object.keys(mismatch).length;
|
|
40
51
|
return {
|
|
41
|
-
url: `${
|
|
52
|
+
url: `${exactPackageUrl}/dist/bundle/${hasMismatch || name !== '@servicetitan/examples' ? 'full' : 'light'}/index.js`,
|
|
42
53
|
WebComponent: metadata.name,
|
|
43
54
|
mismatch: hasMismatch ? mismatch : undefined,
|
|
44
55
|
};
|
|
45
56
|
});
|
|
46
57
|
}
|
|
47
|
-
|
|
58
|
+
exports.Loader = react_1.forwardRef(({ src, data = {}, basename, fallback, className }, ref) => {
|
|
48
59
|
const [isLoading, setIsLoading] = react_1.useState(true);
|
|
49
|
-
const [logService] = react_ioc_1.useOptionalDependencies(log_service_1.Log);
|
|
60
|
+
const [logService, historyManager] = react_ioc_1.useOptionalDependencies(log_service_1.Log, history_manager_1.HistoryManager);
|
|
50
61
|
const dataAttrs = react_1.useMemo(() => Object.fromEntries(Object.entries(data).map(([key, value]) => [
|
|
51
62
|
'data-' + key.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()),
|
|
52
63
|
value,
|
|
53
|
-
])),
|
|
54
|
-
|
|
55
|
-
[...Object.entries(data).map(v => v.join())]);
|
|
64
|
+
])), [...Object.entries(data).map(v => v.join())] // eslint-disable-line react-hooks/exhaustive-deps
|
|
65
|
+
);
|
|
56
66
|
const Loader = react_1.useMemo(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
|
|
67
|
+
const Component = react_1.forwardRef((_0, ref) => {
|
|
68
|
+
const cancelation = common_1.useCancelation();
|
|
69
|
+
const eventBus = common_1.useEventBus();
|
|
70
|
+
react_1.useImperativeHandle(ref, () => ({
|
|
71
|
+
emit(type) {
|
|
72
|
+
eventBus.emit(type);
|
|
73
|
+
},
|
|
74
|
+
}), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
75
|
+
);
|
|
76
|
+
react_1.useEffect(() => {
|
|
77
|
+
setIsLoading(true);
|
|
78
|
+
return () => {
|
|
79
|
+
cancelation.abort();
|
|
80
|
+
};
|
|
81
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
82
|
+
const Lazy = react_1.useMemo(() => react_1.lazy(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
let bundleInfo;
|
|
84
|
+
try {
|
|
85
|
+
bundleInfo = yield getBundleInfo(src, cancelation.signal);
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
if (cancelation.signal.aborted) {
|
|
89
|
+
return {
|
|
90
|
+
default: () => null,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
const { url, WebComponent, mismatch } = bundleInfo;
|
|
96
|
+
if (mismatch) {
|
|
97
|
+
logService === null || logService === void 0 ? void 0 : logService.warning({
|
|
98
|
+
category: 'MicroFrontends.DependenciesMismatch',
|
|
99
|
+
message: 'Some of the package dependencies have incompatible versions.',
|
|
100
|
+
data: { package: src, dependencies: JSON.stringify(mismatch) },
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const script = Array.from(document.scripts).find(({ src }) => src === url);
|
|
104
|
+
if (!script) {
|
|
105
|
+
yield new Promise(resolve => {
|
|
106
|
+
const script = document.createElement('script');
|
|
107
|
+
script.onload = () => {
|
|
108
|
+
script.dataset.webComponent = WebComponent;
|
|
109
|
+
resolve();
|
|
110
|
+
};
|
|
111
|
+
script.async = true;
|
|
112
|
+
script.src = url;
|
|
113
|
+
document.body.append(script);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else if (!script.dataset.webComponent) {
|
|
117
|
+
yield new Promise(resolve => {
|
|
118
|
+
const originalOnload = script.onload;
|
|
119
|
+
script.onload = (...args) => {
|
|
120
|
+
originalOnload === null || originalOnload === void 0 ? void 0 : originalOnload.call(script, ...args);
|
|
121
|
+
resolve();
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const handleRef = (webComponent) => {
|
|
126
|
+
webComponent === null || webComponent === void 0 ? void 0 : webComponent.provide({
|
|
127
|
+
logService,
|
|
128
|
+
historyManager,
|
|
129
|
+
eventBus,
|
|
130
|
+
basename,
|
|
131
|
+
onReady: () => {
|
|
132
|
+
setIsLoading(false);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
default: () => (jsx_runtime_1.jsx(WebComponent, Object.assign({ ref: handleRef, class: className }, dataAttrs), void 0)),
|
|
138
|
+
};
|
|
139
|
+
})), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
140
|
+
);
|
|
141
|
+
return jsx_runtime_1.jsx(Lazy, {}, void 0);
|
|
142
|
+
});
|
|
143
|
+
return Component;
|
|
144
|
+
}, [src, className, logService, historyManager, basename, dataAttrs]);
|
|
145
|
+
return (jsx_runtime_1.jsxs(error_boundary_1.ErrorBoundary, Object.assign({ moduleName: src }, { children: [isLoading && (fallback !== undefined ? fallback : jsx_runtime_1.jsx("h2", { children: "Loading..." }, void 0)), jsx_runtime_1.jsx(react_1.Suspense, Object.assign({ fallback: null }, { children: jsx_runtime_1.jsx(Loader, { ref: ref }, void 0) }), void 0)] }), void 0));
|
|
146
|
+
});
|
|
106
147
|
//# sourceMappingURL=loader.js.map
|
package/dist/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iCAQe;AAEf,iEAA6D;AAC7D,2DAAgD;AAChD,uDAAkE;AAElE,qCAA6F;AAC7F,uDAAmD;AAQnD,SAAS,kBAAkB,CAAC,UAAkB;IAC1C,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAErC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,SAAe,aA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,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,aAAa,EAAE,MAAM,OAAO,CAAC;AAkB1C,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,CAAC,MAAM,kBAAkB,EAAE,MAAM,CAAC;CAC3C;AAeD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,QA0GhE"}
|
package/dist/register.js
CHANGED
|
@@ -5,9 +5,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_dom_1 = require("react-dom");
|
|
6
6
|
const log_service_1 = require("@servicetitan/log-service");
|
|
7
7
|
const design_system_1 = require("@servicetitan/design-system");
|
|
8
|
-
const
|
|
8
|
+
const react_ioc_1 = require("@servicetitan/react-ioc");
|
|
9
9
|
const optional_value_provider_1 = require("./optional-value-provider");
|
|
10
10
|
const common_1 = require("./common");
|
|
11
|
+
const history_manager_1 = require("./history-manager");
|
|
11
12
|
function createLink(url, onLoad) {
|
|
12
13
|
const element = document.createElement('link');
|
|
13
14
|
element.href = url;
|
|
@@ -57,6 +58,18 @@ function register(Component, light) {
|
|
|
57
58
|
writable: true,
|
|
58
59
|
value: void 0
|
|
59
60
|
});
|
|
61
|
+
Object.defineProperty(this, "historyManager", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
value: void 0
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(this, "eventBus", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
configurable: true,
|
|
70
|
+
writable: true,
|
|
71
|
+
value: void 0
|
|
72
|
+
});
|
|
60
73
|
Object.defineProperty(this, "basename", {
|
|
61
74
|
enumerable: true,
|
|
62
75
|
configurable: true,
|
|
@@ -111,9 +124,10 @@ function register(Component, light) {
|
|
|
111
124
|
configurable: true,
|
|
112
125
|
writable: true,
|
|
113
126
|
value: () => {
|
|
114
|
-
react_dom_1.render(
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
react_dom_1.render(jsx_runtime_1.jsx(react_ioc_1.Provider, Object.assign({ singletons: [
|
|
128
|
+
{ provide: common_1.IS_WEB_COMPONENT_TOKEN, useValue: true },
|
|
129
|
+
{ provide: common_1.RENDER_ROOT_TOKEN, useValue: this.root },
|
|
130
|
+
] }, { children: jsx_runtime_1.jsx(design_system_1.DefaultPortalContext.Provider, Object.assign({ value: this.portal }, { children: jsx_runtime_1.jsx(optional_value_provider_1.OptionalValueProvider, Object.assign({ provide: log_service_1.Log, useValue: this.logService }, { children: jsx_runtime_1.jsx(optional_value_provider_1.OptionalValueProvider, Object.assign({ provide: history_manager_1.HistoryManager, useValue: this.historyManager }, { children: jsx_runtime_1.jsx(optional_value_provider_1.OptionalValueProvider, Object.assign({ provide: common_1.EventBus, useValue: this.eventBus }, { children: jsx_runtime_1.jsx(optional_value_provider_1.OptionalValueProvider, Object.assign({ provide: common_1.BASENAME_TOKEN, useValue: this.basename }, { children: jsx_runtime_1.jsx(Component, Object.assign({}, this.dataset), void 0) }), void 0) }), void 0) }), void 0) }), void 0) }), void 0) }), void 0), this.root, this.onReady);
|
|
117
131
|
}
|
|
118
132
|
});
|
|
119
133
|
}
|
package/dist/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.tsx"],"names":[],"mappings":";;;;AACA,yCAA2D;AAE3D,2DAAgD;AAChD,+DAAmE;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.tsx"],"names":[],"mappings":";;;;AACA,yCAA2D;AAE3D,2DAAgD;AAChD,+DAAmE;AACnE,uDAAmD;AAEnD,uEAAkE;AAClE,qCAOkB;AAClB,uDAAmD;AAMnD,SAAS,UAAU,CAAC,GAAW,EAAE,MAAkB;IAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC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IAED,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;AACnE,CAAC;AA1GD,4BA0GC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/web-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,24 +14,27 @@
|
|
|
14
14
|
"src"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@servicetitan/error-boundary": "^16.0.0",
|
|
18
|
+
"mitt": "~3.0.0",
|
|
17
19
|
"semver": "~7.3.5"
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
|
-
"@servicetitan/design-system": "~10.1
|
|
21
|
-
"@servicetitan/
|
|
22
|
-
"@servicetitan/
|
|
23
|
-
"@
|
|
24
|
-
"@types/react": "~17.0.
|
|
22
|
+
"@servicetitan/design-system": "~10.2.1",
|
|
23
|
+
"@servicetitan/log-service": "^16.0.0",
|
|
24
|
+
"@servicetitan/react-ioc": "^16.0.0",
|
|
25
|
+
"@types/history": "~4.7.9",
|
|
26
|
+
"@types/react": "~17.0.24",
|
|
25
27
|
"@types/react-dom": "~17.0.9",
|
|
26
28
|
"@types/semver": "~7.3.8",
|
|
29
|
+
"history": "~4.10.1",
|
|
27
30
|
"react": "~17.0.2",
|
|
28
31
|
"react-dom": "~17.0.2"
|
|
29
32
|
},
|
|
30
33
|
"peerDependencies": {
|
|
31
|
-
"@servicetitan/design-system": "~10.1
|
|
32
|
-
"@servicetitan/error-boundary": "^14.0.0",
|
|
34
|
+
"@servicetitan/design-system": "~10.2.1",
|
|
33
35
|
"@servicetitan/log-service": "^14.0.0",
|
|
34
36
|
"@servicetitan/react-ioc": "^14.0.0",
|
|
37
|
+
"history": "~4.10.1",
|
|
35
38
|
"react": "~17.0.2",
|
|
36
39
|
"react-dom": "~17.0.2"
|
|
37
40
|
},
|
|
@@ -41,5 +44,5 @@
|
|
|
41
44
|
"cli": {
|
|
42
45
|
"webpack": false
|
|
43
46
|
},
|
|
44
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "d2d6e21f4f639bcde5a9ab274a6fd47b14b26974"
|
|
45
48
|
}
|
package/src/common.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
|
|
3
|
+
import mitt from 'mitt';
|
|
4
|
+
|
|
5
|
+
import { useRef } from 'react';
|
|
6
|
+
|
|
3
7
|
import { symbolToken } from '@servicetitan/react-ioc';
|
|
4
8
|
import { Log } from '@servicetitan/log-service';
|
|
5
9
|
|
|
10
|
+
import { HistoryManager } from './history-manager';
|
|
11
|
+
|
|
6
12
|
export const BASENAME_TOKEN = symbolToken<string>('BASENAME_TOKEN');
|
|
13
|
+
export const IS_WEB_COMPONENT_TOKEN = symbolToken<boolean>('IS_WEB_COMPONENT_TOKEN');
|
|
14
|
+
export const RENDER_ROOT_TOKEN = symbolToken<ShadowRoot>('RENDER_ROOT_TOKEN');
|
|
7
15
|
|
|
8
16
|
export interface Entries {
|
|
9
17
|
logService?: Log;
|
|
18
|
+
historyManager?: HistoryManager;
|
|
19
|
+
eventBus?: EventBus;
|
|
10
20
|
basename?: string;
|
|
11
21
|
onReady: () => void;
|
|
12
22
|
}
|
|
@@ -50,3 +60,74 @@ export function isCompatible(hostVersion: string, packageVersion: string) {
|
|
|
50
60
|
|
|
51
61
|
return false;
|
|
52
62
|
}
|
|
63
|
+
|
|
64
|
+
interface GetJsonOptions extends RequestInit {
|
|
65
|
+
retries?: number;
|
|
66
|
+
retryDelay?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function getJson<T = any>(
|
|
70
|
+
url: string,
|
|
71
|
+
{ retries = 5, retryDelay = 1000, ...config }: GetJsonOptions = {}
|
|
72
|
+
): Promise<{ data: T; headers: Headers }> {
|
|
73
|
+
let response: Response;
|
|
74
|
+
try {
|
|
75
|
+
response = await fetch(url, config);
|
|
76
|
+
} catch {
|
|
77
|
+
if (retries > 0) {
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
const { signal } = config;
|
|
80
|
+
|
|
81
|
+
const timeoutId = window.setTimeout(() => {
|
|
82
|
+
getJson(url, {
|
|
83
|
+
...config,
|
|
84
|
+
retries: retries - 1,
|
|
85
|
+
retryDelay: retryDelay * 4,
|
|
86
|
+
}).then(resolve, reject);
|
|
87
|
+
}, retryDelay);
|
|
88
|
+
|
|
89
|
+
signal?.addEventListener('abort', () => window.clearTimeout(timeoutId));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
throw new Error(`Failed to fetch: "${url}".`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!response.ok) {
|
|
97
|
+
let message = `Requesting "${url}" failed with status code ${response.status}.`;
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
message += ` Details: ${await response.text()}.`;
|
|
101
|
+
} catch {} // eslint-disable-line no-empty
|
|
102
|
+
|
|
103
|
+
throw new Error(message);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return { data: await response.json(), headers: response.headers };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function useCancelation() {
|
|
110
|
+
return useRef(new AbortController()).current;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type EventHandler = () => void;
|
|
114
|
+
|
|
115
|
+
export class EventBus {
|
|
116
|
+
private emitter = mitt();
|
|
117
|
+
|
|
118
|
+
on = (type: string, handler: EventHandler) => {
|
|
119
|
+
this.emitter.on(type, handler);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
off = (type: string, handler: EventHandler) => {
|
|
123
|
+
this.emitter.off(type, handler);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
emit = (type: string) => {
|
|
127
|
+
this.emitter.emit(type);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function useEventBus() {
|
|
132
|
+
return useRef(new EventBus()).current;
|
|
133
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { History, Location, UnregisterCallback } from 'history';
|
|
2
|
+
|
|
3
|
+
import { injectable } from '@servicetitan/react-ioc';
|
|
4
|
+
|
|
5
|
+
@injectable()
|
|
6
|
+
export class HistoryManager {
|
|
7
|
+
// Initiator of action, used for filtering redirections
|
|
8
|
+
occupied?: { history: History; location: Location };
|
|
9
|
+
|
|
10
|
+
storage = new Map<History, UnregisterCallback>();
|
|
11
|
+
|
|
12
|
+
register = (addable: History) => {
|
|
13
|
+
this.storage.set(
|
|
14
|
+
addable,
|
|
15
|
+
addable.listen(location => {
|
|
16
|
+
const path = addable.createHref(location);
|
|
17
|
+
const state = location.state;
|
|
18
|
+
|
|
19
|
+
if (!this.occupied) {
|
|
20
|
+
this.occupied = { history: addable, location };
|
|
21
|
+
} else if (this.occupied.history === addable) {
|
|
22
|
+
this.occupied.location = location;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const history of this.storage.keys()) {
|
|
26
|
+
if (history === addable) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (
|
|
31
|
+
history.createHref(history.location) === path &&
|
|
32
|
+
history.location.state === state
|
|
33
|
+
) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Allow redirects only to the deeper pages
|
|
38
|
+
const unblock = history.block(location => {
|
|
39
|
+
if (
|
|
40
|
+
this.occupied &&
|
|
41
|
+
!history
|
|
42
|
+
.createHref(location)
|
|
43
|
+
.startsWith(
|
|
44
|
+
this.occupied.history.createHref(this.occupied.location)
|
|
45
|
+
)
|
|
46
|
+
) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
history.replace(path, state);
|
|
52
|
+
|
|
53
|
+
unblock();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Wait for all updates, including redirections
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
if (
|
|
59
|
+
this.occupied?.history === addable &&
|
|
60
|
+
this.occupied?.location === location
|
|
61
|
+
) {
|
|
62
|
+
this.occupied = undefined;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
unregister = (removable: History) => {
|
|
70
|
+
if (this.storage.has(removable)) {
|
|
71
|
+
this.storage.get(removable)!();
|
|
72
|
+
this.storage.delete(removable);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/index.ts
CHANGED
package/src/loader.tsx
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
lazy,
|
|
3
|
+
Suspense,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
forwardRef,
|
|
8
|
+
useImperativeHandle,
|
|
9
|
+
} from 'react';
|
|
2
10
|
|
|
3
11
|
import { ErrorBoundary } from '@servicetitan/error-boundary';
|
|
4
12
|
import { Log } from '@servicetitan/log-service';
|
|
5
13
|
import { useOptionalDependencies } from '@servicetitan/react-ioc';
|
|
6
14
|
|
|
7
|
-
import {
|
|
15
|
+
import { useCancelation, useEventBus, getJson, isCompatible, IWebComponent } from './common';
|
|
16
|
+
import { HistoryManager } from './history-manager';
|
|
17
|
+
|
|
18
|
+
type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T;
|
|
8
19
|
|
|
9
20
|
declare global {
|
|
10
21
|
export const EXPOSED_DEPENDENCIES: Record<string, { version: string; variable: string }>;
|
|
11
22
|
}
|
|
12
23
|
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
24
|
+
function omitPackageVersion(packageUrl: string) {
|
|
25
|
+
const chunks = packageUrl.split('@');
|
|
26
|
+
|
|
27
|
+
if (chunks.length > 2) {
|
|
28
|
+
return chunks.slice(0, -1).join('@');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return packageUrl;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function getBundleInfo(packageUrl: string, signal?: AbortSignal) {
|
|
35
|
+
const {
|
|
36
|
+
data: { dependencies, name, version },
|
|
37
|
+
headers,
|
|
38
|
+
} = await getJson(`${packageUrl}/package.json`, { cache: 'no-store', signal });
|
|
39
|
+
|
|
40
|
+
const exactPackageUrl =
|
|
41
|
+
headers.get('X-Delivered-By') === 'unpkg'
|
|
42
|
+
? `${omitPackageVersion(packageUrl)}@${version}`
|
|
43
|
+
: packageUrl;
|
|
44
|
+
|
|
45
|
+
const { data: metadata } = await getJson(`${exactPackageUrl}/dist/metadata.json`, { signal });
|
|
16
46
|
|
|
17
47
|
const mismatch = Object.entries(EXPOSED_DEPENDENCIES).reduce(
|
|
18
48
|
(result, [dependency, { version: hostVersion }]) => {
|
|
@@ -39,7 +69,7 @@ async function getBundleInfo(packageUrl: string) {
|
|
|
39
69
|
|
|
40
70
|
const hasMismatch = !!Object.keys(mismatch).length;
|
|
41
71
|
return {
|
|
42
|
-
url: `${
|
|
72
|
+
url: `${exactPackageUrl}/dist/bundle/${
|
|
43
73
|
hasMismatch || name !== '@servicetitan/examples' ? 'full' : 'light'
|
|
44
74
|
}/index.js`,
|
|
45
75
|
WebComponent: metadata.name,
|
|
@@ -47,6 +77,10 @@ async function getBundleInfo(packageUrl: string) {
|
|
|
47
77
|
};
|
|
48
78
|
}
|
|
49
79
|
|
|
80
|
+
export interface LoaderRef {
|
|
81
|
+
emit(type: string): void;
|
|
82
|
+
}
|
|
83
|
+
|
|
50
84
|
export interface LoaderProps {
|
|
51
85
|
src: string;
|
|
52
86
|
data?: Record<string, string>;
|
|
@@ -55,89 +89,138 @@ export interface LoaderProps {
|
|
|
55
89
|
className?: string;
|
|
56
90
|
}
|
|
57
91
|
|
|
58
|
-
export const Loader
|
|
59
|
-
src,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (!script) {
|
|
97
|
-
await new Promise<void>(resolve => {
|
|
98
|
-
const script = document.createElement('script');
|
|
99
|
-
|
|
100
|
-
script.onload = () => {
|
|
101
|
-
script.dataset.webComponent = WebComponent;
|
|
102
|
-
resolve();
|
|
92
|
+
export const Loader = forwardRef<LoaderRef, LoaderProps>(
|
|
93
|
+
({ src, data = {}, basename, fallback, className }, ref) => {
|
|
94
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
95
|
+
|
|
96
|
+
const [logService, historyManager] = useOptionalDependencies(Log, HistoryManager);
|
|
97
|
+
|
|
98
|
+
const dataAttrs = useMemo(
|
|
99
|
+
() =>
|
|
100
|
+
Object.fromEntries(
|
|
101
|
+
Object.entries(data).map(([key, value]) => [
|
|
102
|
+
'data-' + key.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()),
|
|
103
|
+
value,
|
|
104
|
+
])
|
|
105
|
+
),
|
|
106
|
+
|
|
107
|
+
[...Object.entries(data).map(v => v.join())] // eslint-disable-line react-hooks/exhaustive-deps
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const Loader = useMemo(() => {
|
|
111
|
+
const Component = forwardRef<LoaderRef>((_0, ref) => {
|
|
112
|
+
const cancelation = useCancelation();
|
|
113
|
+
const eventBus = useEventBus();
|
|
114
|
+
|
|
115
|
+
useImperativeHandle(
|
|
116
|
+
ref,
|
|
117
|
+
() => ({
|
|
118
|
+
emit(type) {
|
|
119
|
+
eventBus.emit(type);
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
[] // eslint-disable-line react-hooks/exhaustive-deps
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
setIsLoading(true);
|
|
127
|
+
|
|
128
|
+
return () => {
|
|
129
|
+
cancelation.abort();
|
|
103
130
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
};
|
|
131
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
132
|
+
|
|
133
|
+
const Lazy = useMemo(
|
|
134
|
+
() =>
|
|
135
|
+
lazy<() => JSX.Element | null>(async () => {
|
|
136
|
+
let bundleInfo: Awaited<ReturnType<typeof getBundleInfo>>;
|
|
137
|
+
try {
|
|
138
|
+
bundleInfo = await getBundleInfo(src, cancelation.signal);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
if (cancelation.signal.aborted) {
|
|
141
|
+
return {
|
|
142
|
+
default: () => null,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
throw e;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const { url, WebComponent, mismatch } = bundleInfo;
|
|
150
|
+
|
|
151
|
+
if (mismatch) {
|
|
152
|
+
logService?.warning({
|
|
153
|
+
category: 'MicroFrontends.DependenciesMismatch',
|
|
154
|
+
message:
|
|
155
|
+
'Some of the package dependencies have incompatible versions.',
|
|
156
|
+
data: { package: src, dependencies: JSON.stringify(mismatch) },
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const script = Array.from(document.scripts).find(
|
|
161
|
+
({ src }) => src === url
|
|
162
|
+
);
|
|
163
|
+
if (!script) {
|
|
164
|
+
await new Promise<void>(resolve => {
|
|
165
|
+
const script = document.createElement('script');
|
|
166
|
+
|
|
167
|
+
script.onload = () => {
|
|
168
|
+
script.dataset.webComponent = WebComponent;
|
|
169
|
+
resolve();
|
|
170
|
+
};
|
|
171
|
+
script.async = true;
|
|
172
|
+
script.src = url;
|
|
173
|
+
|
|
174
|
+
document.body.append(script);
|
|
175
|
+
});
|
|
176
|
+
} else if (!script.dataset.webComponent) {
|
|
177
|
+
await new Promise<void>(resolve => {
|
|
178
|
+
const originalOnload = script.onload;
|
|
179
|
+
script.onload = (...args) => {
|
|
180
|
+
originalOnload?.call(script, ...args);
|
|
181
|
+
resolve();
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const handleRef = (webComponent: IWebComponent | null) => {
|
|
187
|
+
webComponent?.provide({
|
|
188
|
+
logService,
|
|
189
|
+
historyManager,
|
|
190
|
+
eventBus,
|
|
191
|
+
basename,
|
|
192
|
+
onReady: () => {
|
|
193
|
+
setIsLoading(false);
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
default: () => (
|
|
200
|
+
<WebComponent
|
|
201
|
+
ref={handleRef}
|
|
202
|
+
class={className}
|
|
203
|
+
{...dataAttrs}
|
|
204
|
+
/>
|
|
205
|
+
),
|
|
206
|
+
};
|
|
207
|
+
}),
|
|
208
|
+
[] // eslint-disable-line react-hooks/exhaustive-deps
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
return <Lazy />;
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
return Component;
|
|
215
|
+
}, [src, className, logService, historyManager, basename, dataAttrs]);
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<ErrorBoundary moduleName={src}>
|
|
219
|
+
{isLoading && (fallback !== undefined ? fallback : <h2>Loading...</h2>)}
|
|
220
|
+
<Suspense fallback={null}>
|
|
221
|
+
<Loader ref={ref} />
|
|
222
|
+
</Suspense>
|
|
223
|
+
</ErrorBoundary>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
);
|
package/src/register.tsx
CHANGED
|
@@ -3,10 +3,18 @@ import { render, unmountComponentAtNode } from 'react-dom';
|
|
|
3
3
|
|
|
4
4
|
import { Log } from '@servicetitan/log-service';
|
|
5
5
|
import { DefaultPortalContext } from '@servicetitan/design-system';
|
|
6
|
+
import { Provider } from '@servicetitan/react-ioc';
|
|
6
7
|
|
|
7
|
-
import { IsWebComponentContext } from './is-web-component-context';
|
|
8
8
|
import { OptionalValueProvider } from './optional-value-provider';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Entries,
|
|
11
|
+
EventBus,
|
|
12
|
+
IWebComponent,
|
|
13
|
+
BASENAME_TOKEN,
|
|
14
|
+
IS_WEB_COMPONENT_TOKEN,
|
|
15
|
+
RENDER_ROOT_TOKEN,
|
|
16
|
+
} from './common';
|
|
17
|
+
import { HistoryManager } from './history-manager';
|
|
10
18
|
|
|
11
19
|
declare global {
|
|
12
20
|
export const WEB_COMPONENT_NAME: string;
|
|
@@ -48,6 +56,8 @@ export function register(Component: ComponentType, light: boolean) {
|
|
|
48
56
|
};
|
|
49
57
|
|
|
50
58
|
private logService?: Log;
|
|
59
|
+
private historyManager?: HistoryManager;
|
|
60
|
+
private eventBus?: EventBus;
|
|
51
61
|
private basename?: string;
|
|
52
62
|
private onReady?: () => void;
|
|
53
63
|
|
|
@@ -98,19 +108,30 @@ export function register(Component: ComponentType, light: boolean) {
|
|
|
98
108
|
|
|
99
109
|
private render = () => {
|
|
100
110
|
render(
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
<Provider
|
|
112
|
+
singletons={[
|
|
113
|
+
{ provide: IS_WEB_COMPONENT_TOKEN, useValue: true },
|
|
114
|
+
{ provide: RENDER_ROOT_TOKEN, useValue: this.root },
|
|
115
|
+
]}
|
|
116
|
+
>
|
|
103
117
|
<DefaultPortalContext.Provider value={this.portal as unknown as HTMLElement}>
|
|
104
118
|
<OptionalValueProvider provide={Log} useValue={this.logService}>
|
|
105
119
|
<OptionalValueProvider
|
|
106
|
-
provide={
|
|
107
|
-
useValue={this.
|
|
120
|
+
provide={HistoryManager}
|
|
121
|
+
useValue={this.historyManager}
|
|
108
122
|
>
|
|
109
|
-
<
|
|
123
|
+
<OptionalValueProvider provide={EventBus} useValue={this.eventBus}>
|
|
124
|
+
<OptionalValueProvider
|
|
125
|
+
provide={BASENAME_TOKEN}
|
|
126
|
+
useValue={this.basename}
|
|
127
|
+
>
|
|
128
|
+
<Component {...this.dataset} />
|
|
129
|
+
</OptionalValueProvider>
|
|
130
|
+
</OptionalValueProvider>
|
|
110
131
|
</OptionalValueProvider>
|
|
111
132
|
</OptionalValueProvider>
|
|
112
133
|
</DefaultPortalContext.Provider>
|
|
113
|
-
</
|
|
134
|
+
</Provider>,
|
|
114
135
|
this.root,
|
|
115
136
|
this.onReady
|
|
116
137
|
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-web-component-context.d.ts","sourceRoot":"","sources":["../src/is-web-component-context.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,qBAAqB,kCAAuB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsWebComponentContext = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
exports.IsWebComponentContext = react_1.createContext(false);
|
|
6
|
-
//# sourceMappingURL=is-web-component-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-web-component-context.js","sourceRoot":"","sources":["../src/is-web-component-context.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAEzB,QAAA,qBAAqB,GAAG,qBAAa,CAAC,KAAK,CAAC,CAAC"}
|