@pushwoosh/single-spa 0.2.5 → 0.2.7
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/Parcel.js +4 -3
- package/createApplicationFunction.js +24 -19
- package/createParcelFunction.js +7 -6
- package/package.json +3 -3
package/Parcel.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { mountRootParcel } from 'single-spa';
|
|
3
4
|
import SingleSpaParcel from 'single-spa-react/parcel';
|
|
4
5
|
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
@@ -14,7 +15,7 @@ export const Parcel = ({
|
|
|
14
15
|
return {
|
|
15
16
|
bootstrap(props) {
|
|
16
17
|
return System.import(module).then(imported => {
|
|
17
|
-
// eslint-disable-next-line react/prop-types
|
|
18
|
+
// eslint-disable-next-line react/prop-types, react-hooks/immutability
|
|
18
19
|
parcel = imported[parcelFunctionName](props.domElement);
|
|
19
20
|
});
|
|
20
21
|
},
|
|
@@ -32,7 +33,7 @@ export const Parcel = ({
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
}, [module, parcelFunctionName]);
|
|
35
|
-
return
|
|
36
|
+
return _createElement(SingleSpaParcel, {
|
|
36
37
|
...transferProps,
|
|
37
38
|
spaContext: spaContext,
|
|
38
39
|
config: parcelConfig,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import React, { Component } from 'react';
|
|
2
3
|
import ReactDOMClient from 'react-dom/client';
|
|
3
4
|
import singleSpaReact from 'single-spa-react';
|
|
@@ -20,7 +21,7 @@ export function createApplicationFunction(Comp) {
|
|
|
20
21
|
}
|
|
21
22
|
render() {
|
|
22
23
|
if (this.state.hasError) {
|
|
23
|
-
return
|
|
24
|
+
return _jsxs("div", {
|
|
24
25
|
style: {
|
|
25
26
|
display: 'flex',
|
|
26
27
|
flexDirection: 'column',
|
|
@@ -30,25 +31,29 @@ export function createApplicationFunction(Comp) {
|
|
|
30
31
|
margin: '64px auto',
|
|
31
32
|
padding: 24,
|
|
32
33
|
textAlign: 'center'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
},
|
|
35
|
+
children: [_jsx("h2", {
|
|
36
|
+
style: {
|
|
37
|
+
margin: '0 0 8px',
|
|
38
|
+
fontSize: 20,
|
|
39
|
+
fontWeight: 500
|
|
40
|
+
},
|
|
41
|
+
children: "Something went wrong"
|
|
42
|
+
}), _jsx("p", {
|
|
43
|
+
style: {
|
|
44
|
+
margin: 0,
|
|
45
|
+
color: '#7C8595'
|
|
46
|
+
},
|
|
47
|
+
children: "Please refresh the page or try again later."
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
46
50
|
}
|
|
47
|
-
return
|
|
48
|
-
value: this.props.spaContext
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
return _jsx(SPAContextProvider, {
|
|
52
|
+
value: this.props.spaContext,
|
|
53
|
+
children: _jsx(Comp, {
|
|
54
|
+
...this.props
|
|
55
|
+
})
|
|
56
|
+
});
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
return singleSpaReact({
|
package/createParcelFunction.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import { SPAContextProvider } from '@pushwoosh/spa-context';
|
|
4
4
|
export function createParcelFunction(Comp) {
|
|
@@ -6,11 +6,12 @@ export function createParcelFunction(Comp) {
|
|
|
6
6
|
const root = createRoot(container);
|
|
7
7
|
return {
|
|
8
8
|
render(props) {
|
|
9
|
-
root.render(
|
|
10
|
-
value: props.spaContext
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
root.render(_jsx(SPAContextProvider, {
|
|
10
|
+
value: props.spaContext,
|
|
11
|
+
children: _jsx(Comp, {
|
|
12
|
+
...props
|
|
13
|
+
})
|
|
14
|
+
}));
|
|
14
15
|
},
|
|
15
16
|
unmount() {
|
|
16
17
|
root.unmount();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/single-spa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "React component for build Pushwoosh products",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"pre-commit": "check",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@pushwoosh/frontend-builder-engine": "^1.
|
|
18
|
+
"@pushwoosh/frontend-builder-engine": "^2.1.1",
|
|
19
19
|
"@pushwoosh/kit-constants": "^1.6.0",
|
|
20
20
|
"@types/react": "^18.3.28",
|
|
21
21
|
"@types/react-dom": "^18.3.7",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"node": ">= 18"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@pushwoosh/spa-context": "^1.
|
|
34
|
+
"@pushwoosh/spa-context": "^1.5.0",
|
|
35
35
|
"single-spa": "^5.9.5",
|
|
36
36
|
"single-spa-react": "^6.0.2"
|
|
37
37
|
}
|