@servicetitan/web-components 22.21.0 → 23.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/get-mfe-supports-rerendering.js +3 -2
- package/dist/get-mfe-supports-rerendering.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/common.test.ts +2 -2
- package/src/__tests__/get-mfe-supports-rerendering.test.ts +23 -0
- package/src/__tests__/register.test.tsx +2 -0
- package/src/get-mfe-supports-rerendering.ts +3 -2
|
@@ -14,8 +14,9 @@ export function getMFESupportsRerendering(bundledWith, dependencies) {
|
|
|
14
14
|
return !!((_b = (_a = isSupportedVersion(bundledWith === null || bundledWith === void 0 ? void 0 : bundledWith['@servicetitan/web-components'])) !== null && _a !== void 0 ? _a : isSupportedVersion(dependencies === null || dependencies === void 0 ? void 0 : dependencies['@servicetitan/web-components'])) !== null && _b !== void 0 ? _b : isSupportedVersion(bundledWith === null || bundledWith === void 0 ? void 0 : bundledWith['@servicetitan/startup']));
|
|
15
15
|
}
|
|
16
16
|
function isSupportedVersion(version) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const minVersion = version && semver.minVersion(version);
|
|
18
|
+
if (minVersion) {
|
|
19
|
+
return semver.gte(minVersion, '22.12.0');
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
//# sourceMappingURL=get-mfe-supports-rerendering.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-mfe-supports-rerendering.js","sourceRoot":"","sources":["../src/get-mfe-supports-rerendering.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CACrC,WAAoC,EACpC,YAAsC;;IAEtC,OAAO,CAAC,CAAC,CACL,MAAA,MAAA,kBAAkB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,8BAA8B,CAAC,CAAC,mCACjE,kBAAkB,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,8BAA8B,CAAC,CAAC,mCAClE,kBAAkB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,uBAAuB,CAAC,CAAC,CAC7D,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAgB;IACxC,IAAI,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"get-mfe-supports-rerendering.js","sourceRoot":"","sources":["../src/get-mfe-supports-rerendering.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CACrC,WAAoC,EACpC,YAAsC;;IAEtC,OAAO,CAAC,CAAC,CACL,MAAA,MAAA,kBAAkB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,8BAA8B,CAAC,CAAC,mCACjE,kBAAkB,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,8BAA8B,CAAC,CAAC,mCAClE,kBAAkB,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,uBAAuB,CAAC,CAAC,CAC7D,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAgB;IACxC,MAAM,UAAU,GAAG,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,UAAU,EAAE;QACZ,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;KAC5C;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/web-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"src"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@servicetitan/error-boundary": "
|
|
18
|
+
"@servicetitan/error-boundary": "23.0.0",
|
|
19
19
|
"lodash.get": "~4.4.2",
|
|
20
20
|
"mitt": "~3.0.1",
|
|
21
21
|
"semver": "~7.5.4"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@servicetitan/design-system": "~12.6.2",
|
|
25
|
-
"@servicetitan/log-service": "
|
|
26
|
-
"@servicetitan/react-ioc": "
|
|
25
|
+
"@servicetitan/log-service": "23.0.0",
|
|
26
|
+
"@servicetitan/react-ioc": "23.0.0",
|
|
27
27
|
"@testing-library/dom": "^8.20.1",
|
|
28
|
-
"@testing-library/jest-dom": "^6.
|
|
28
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
29
29
|
"@testing-library/react": "^12.1.5",
|
|
30
30
|
"@testing-library/react-hooks": "^8.0.1",
|
|
31
31
|
"@types/history": "~4.7.10",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@servicetitan/design-system": "~12.6.2",
|
|
43
|
-
"@servicetitan/log-service": "
|
|
44
|
-
"@servicetitan/react-ioc": "
|
|
43
|
+
"@servicetitan/log-service": "23.0.0",
|
|
44
|
+
"@servicetitan/react-ioc": "23.0.0",
|
|
45
45
|
"history": "~4.10.1",
|
|
46
46
|
"react": "~17.0.2",
|
|
47
47
|
"react-dom": "~17.0.2"
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"cli": {
|
|
53
53
|
"webpack": false
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "45876ed36415ad78d3ec4ef3783d6df1430504d3"
|
|
56
56
|
}
|
|
@@ -265,7 +265,7 @@ describe('[web-components] common', () => {
|
|
|
265
265
|
await flushMicrotasks();
|
|
266
266
|
abortController.abort();
|
|
267
267
|
|
|
268
|
-
await expect(result).rejects.
|
|
268
|
+
await expect(result).rejects.toThrowError(/The operation was aborted/);
|
|
269
269
|
|
|
270
270
|
await flushMicrotasksAndRunAllTimersTimes(getJsonOptions.retries!);
|
|
271
271
|
|
|
@@ -276,7 +276,7 @@ describe('[web-components] common', () => {
|
|
|
276
276
|
const result = subject();
|
|
277
277
|
await flushMicrotasksAndRunAllTimersTimes(1);
|
|
278
278
|
abortController.abort();
|
|
279
|
-
await expect(result).rejects.
|
|
279
|
+
await expect(result).rejects.toThrowError(/The operation was aborted/);
|
|
280
280
|
await flushMicrotasksAndRunAllTimersTimes(getJsonOptions.retries!);
|
|
281
281
|
expect(spyFetch).toHaveBeenCalledTimes(2);
|
|
282
282
|
});
|
|
@@ -17,6 +17,12 @@ describe(`[web-components] ${getMFESupportsRerendering.name}`, () => {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function itRaises(error: any) {
|
|
21
|
+
test(`raises ${error.name}`, () => {
|
|
22
|
+
expect(() => subject()).toThrow(error);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
function subject() {
|
|
21
27
|
return getMFESupportsRerendering(metadata.bundledWith, metadata.dependencies);
|
|
22
28
|
}
|
|
@@ -41,6 +47,13 @@ describe(`[web-components] ${getMFESupportsRerendering.name}`, () => {
|
|
|
41
47
|
const dependencies: { name: string; version: string; expected: boolean }[] = [
|
|
42
48
|
{ name: 'web-components', version: '22.11.0', expected: false },
|
|
43
49
|
{ name: 'web-components', version: '22.12.0', expected: true },
|
|
50
|
+
/*
|
|
51
|
+
* The reason we expect this to be false is because we do not know the true version
|
|
52
|
+
* of web-components when there is a semver range. We can only assume that it is the
|
|
53
|
+
* lowest version in the range.
|
|
54
|
+
*/
|
|
55
|
+
{ name: 'web-components', version: '^22.11.0', expected: false },
|
|
56
|
+
{ name: 'web-components', version: '~22.12.0', expected: true },
|
|
44
57
|
];
|
|
45
58
|
|
|
46
59
|
describe.each(dependencies)(
|
|
@@ -73,4 +86,14 @@ describe(`[web-components] ${getMFESupportsRerendering.name}`, () => {
|
|
|
73
86
|
});
|
|
74
87
|
itReturns(false);
|
|
75
88
|
});
|
|
89
|
+
|
|
90
|
+
const deps: ['bundledWith' | 'dependencies', string][] = [
|
|
91
|
+
['bundledWith', '@servicetitan/web-components'],
|
|
92
|
+
['dependencies', '@servicetitan/web-components'],
|
|
93
|
+
['bundledWith', '@servicetitan/startup'],
|
|
94
|
+
];
|
|
95
|
+
describe.each(deps)(`when %s[%s] version is not a semver`, (key, depName) => {
|
|
96
|
+
beforeEach(() => (metadata[key][depName] = 'foobar'));
|
|
97
|
+
itRaises(TypeError);
|
|
98
|
+
});
|
|
76
99
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FC, useContext } from 'react';
|
|
2
2
|
import { TablePopupPropsContext } from '@servicetitan/design-system';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-ignore because Jest mistakenly complains that "'shadow-dom-testing-library' cannot be imported using this construct".
|
|
4
6
|
import { screen } from 'shadow-dom-testing-library';
|
|
5
7
|
import '@testing-library/jest-dom';
|
|
6
8
|
|
|
@@ -23,7 +23,8 @@ export function getMFESupportsRerendering(
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function isSupportedVersion(version?: string) {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const minVersion = version && semver.minVersion(version);
|
|
27
|
+
if (minVersion) {
|
|
28
|
+
return semver.gte(minVersion, '22.12.0');
|
|
28
29
|
}
|
|
29
30
|
}
|