@ebay/muse-lib-react 1.3.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.
Files changed (94) hide show
  1. package/README.md +19 -0
  2. package/build/dev/asset-manifest.json +11 -0
  3. package/build/dev/favicon.png +0 -0
  4. package/build/dev/lib-manifest.json +3374 -0
  5. package/build/dev/main.js +75839 -0
  6. package/build/dev/main.js.map +1 -0
  7. package/build/dev/muse.d.ts +170 -0
  8. package/build/dev/static/media/logo.b23b880b0dac2229042c.png +0 -0
  9. package/build/dev/static/media/subAppLoading2.bf08007b83457287ade1cedb71bc70f7.svg +7 -0
  10. package/build/dist/asset-manifest.json +11 -0
  11. package/build/dist/favicon.png +0 -0
  12. package/build/dist/lib-manifest.json +3603 -0
  13. package/build/dist/main.js +3 -0
  14. package/build/dist/main.js.LICENSE.txt +134 -0
  15. package/build/dist/main.js.map +1 -0
  16. package/build/dist/muse.d.ts +170 -0
  17. package/build/dist/static/media/logo.b23b880b0dac2229042c.png +0 -0
  18. package/build/dist/static/media/subAppLoading2.bf08007b83457287ade1cedb71bc70f7.svg +7 -0
  19. package/build/test/asset-manifest.json +11 -0
  20. package/build/test/favicon.png +0 -0
  21. package/build/test/lib-manifest.json +3587 -0
  22. package/build/test/main.js +3 -0
  23. package/build/test/main.js.LICENSE.txt +134 -0
  24. package/build/test/main.js.map +1 -0
  25. package/build/test/muse.d.ts +170 -0
  26. package/build/test/static/media/logo.b23b880b0dac2229042c.png +0 -0
  27. package/build/test/static/media/subAppLoading2.bf08007b83457287ade1cedb71bc70f7.svg +7 -0
  28. package/package.json +88 -0
  29. package/src/Root.js +195 -0
  30. package/src/common/configStore.js +40 -0
  31. package/src/common/history.js +25 -0
  32. package/src/common/rootReducer.js +40 -0
  33. package/src/common/routeConfig.js +135 -0
  34. package/src/common/store.js +21 -0
  35. package/src/features/common/ErrorBoundary.js +24 -0
  36. package/src/features/common/ErrorBoundary.less +6 -0
  37. package/src/features/common/Nodes.js +20 -0
  38. package/src/features/common/PageNotFound.js +3 -0
  39. package/src/features/common/PageNotFound.less +6 -0
  40. package/src/features/common/index.js +4 -0
  41. package/src/features/common/redux/actions.js +0 -0
  42. package/src/features/common/redux/constants.js +0 -0
  43. package/src/features/common/redux/initialState.js +12 -0
  44. package/src/features/common/redux/reducer.js +24 -0
  45. package/src/features/common/route.js +9 -0
  46. package/src/features/common/style.less +3 -0
  47. package/src/features/common/useExtPoint.js +28 -0
  48. package/src/features/common/utils.js +20 -0
  49. package/src/features/home/App.js +33 -0
  50. package/src/features/home/App.less +11 -0
  51. package/src/features/home/Homepage.js +46 -0
  52. package/src/features/home/Homepage.less +63 -0
  53. package/src/features/home/index.js +2 -0
  54. package/src/features/home/redux/actions.js +0 -0
  55. package/src/features/home/redux/constants.js +0 -0
  56. package/src/features/home/redux/initialState.js +4 -0
  57. package/src/features/home/redux/reducer.js +16 -0
  58. package/src/features/home/route.js +6 -0
  59. package/src/features/home/style.less +3 -0
  60. package/src/features/sub-app/C2SProxyFailed.js +10 -0
  61. package/src/features/sub-app/C2SProxyFailed.less +19 -0
  62. package/src/features/sub-app/FixedSubAppContainer.js +142 -0
  63. package/src/features/sub-app/FixedSubAppContainer.less +12 -0
  64. package/src/features/sub-app/LoadingSkeleton.js +21 -0
  65. package/src/features/sub-app/LoadingSkeleton.less +20 -0
  66. package/src/features/sub-app/SubAppContainer.js +203 -0
  67. package/src/features/sub-app/SubAppContainer.less +29 -0
  68. package/src/features/sub-app/SubAppContext.js +4 -0
  69. package/src/features/sub-app/hooks/useParentRouteChange.js +23 -0
  70. package/src/features/sub-app/index.js +5 -0
  71. package/src/features/sub-app/redux/actions.js +1 -0
  72. package/src/features/sub-app/redux/constants.js +2 -0
  73. package/src/features/sub-app/redux/hooks.js +1 -0
  74. package/src/features/sub-app/redux/initialState.js +12 -0
  75. package/src/features/sub-app/redux/reducer.js +25 -0
  76. package/src/features/sub-app/redux/setSubAppState.js +43 -0
  77. package/src/features/sub-app/route.js +43 -0
  78. package/src/features/sub-app/style.less +5 -0
  79. package/src/features/sub-app/subAppLoading.svg +7 -0
  80. package/src/features/sub-app/subAppLoading2.html +83 -0
  81. package/src/features/sub-app/subAppLoading2.svg +7 -0
  82. package/src/features/sub-app/subAppLoading3.svg +7 -0
  83. package/src/features/sub-app/subAppLoading4.svg +7 -0
  84. package/src/features/sub-app/urlUtils.js +101 -0
  85. package/src/images/logo.png +0 -0
  86. package/src/index.css +3 -0
  87. package/src/index.js +41 -0
  88. package/src/muse-ext.d.ts +1 -0
  89. package/src/muse.d.ts +163 -0
  90. package/src/react-app-env.d.ts +1 -0
  91. package/src/styles/global.less +9 -0
  92. package/src/styles/index.less +5 -0
  93. package/src/styles/mixins.less +0 -0
  94. package/src/utils.js +26 -0
@@ -0,0 +1,83 @@
1
+
2
+ <!-- saved from url=(0057)file:///Users/pwang7/Downloads/Gear%20Set-0.2s-200px.html -->
3
+ <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head><body><div class="loadingio-spinner-gear-set-62pvb5t3ym5"><div class="ldio-u78qioxne7">
4
+ <div><div></div><div></div><div></div><div></div><div></div><div></div></div>
5
+ <div><div></div><div></div><div></div><div></div><div></div><div></div></div>
6
+ <div><div></div><div></div><div></div><div></div><div></div><div></div></div>
7
+ </div></div>
8
+ <style type="text/css">
9
+ @keyframes ldio-u78qioxne7-1 {
10
+ 0% { transform: rotate(0deg) scale(0.5) translate(-34px,-34px) }
11
+ 50% { transform: rotate(22.5deg) scale(0.5) translate(-34px,-34px) }
12
+ 100% { transform: rotate(45deg) scale(0.5) translate(-34px,-34px) }
13
+ }
14
+ @keyframes ldio-u78qioxne7-2 {
15
+ 0% { transform: rotate(45deg) scale(0.4) translate(0px,44px) }
16
+ 50% { transform: rotate(22.5deg) scale(0.4) translate(0px,44px) }
17
+ 100% { transform: rotate(0deg) scale(0.4) translate(0px,44px) }
18
+ }
19
+ @keyframes ldio-u78qioxne7-3 {
20
+ 0% { transform: rotate(0deg) scale(0.3) translate(56px,8px) }
21
+ 50% { transform: rotate(22.5deg) scale(0.3) translate(56px,8px) }
22
+ 100% { transform: rotate(45deg) scale(0.3) translate(56px,8px) }
23
+ }
24
+ .ldio-u78qioxne7 > div {
25
+ transform-origin: 66px 66px;
26
+ animation: ldio-u78qioxne7-1 0.2s infinite linear;
27
+ }
28
+ .ldio-u78qioxne7 > div:nth-child(2) {
29
+ transform-origin: 100px 144px;
30
+ animation: ldio-u78qioxne7-2 0.2s infinite linear;
31
+ animation-delay: -0.1s;
32
+ }
33
+ .ldio-u78qioxne7 > div:nth-child(3) {
34
+ transform-origin: 156px 108px;
35
+ animation: ldio-u78qioxne7-3 0.2s infinite linear;
36
+ animation-delay: -0.1s;
37
+ }
38
+ .ldio-u78qioxne7 div:nth-child(1) > div { background: #86b817 }
39
+ .ldio-u78qioxne7 div:nth-child(2) > div { background: #e53238 }
40
+ .ldio-u78qioxne7 div:nth-child(3) > div { background: #f5af02 }
41
+ .ldio-u78qioxne7 div > div {
42
+ position: absolute;
43
+ width: 28px;
44
+ height: 192px;
45
+ left: 100px;
46
+ top: 100px;
47
+ transform: translate(-50%,-50%);
48
+ }
49
+ .ldio-u78qioxne7 div > div:nth-child(1) {
50
+ width: 152px;
51
+ height: 152px;
52
+ border-radius: 50%;
53
+ }
54
+ .ldio-u78qioxne7 div > div:nth-child(6) {
55
+ width: 92px;
56
+ height: 92px;
57
+ background: #ffffff;
58
+ border-radius: 50%;
59
+ }.ldio-u78qioxne7 div > div:nth-child(3) {
60
+ transform: translate(-50%,-50%) rotate(45deg)
61
+ }.ldio-u78qioxne7 div > div:nth-child(4) {
62
+ transform: translate(-50%,-50%) rotate(90deg)
63
+ }.ldio-u78qioxne7 div > div:nth-child(5) {
64
+ transform: translate(-50%,-50%) rotate(135deg)
65
+ }
66
+ .loadingio-spinner-gear-set-62pvb5t3ym5 {
67
+ width: 200px;
68
+ height: 200px;
69
+ display: inline-block;
70
+ overflow: hidden;
71
+ background: #ffffff;
72
+ }
73
+ .ldio-u78qioxne7 {
74
+ width: 100%;
75
+ height: 100%;
76
+ position: relative;
77
+ transform: translateZ(0) scale(1);
78
+ backface-visibility: hidden;
79
+ transform-origin: 0 0; /* see note above */
80
+ }
81
+ .ldio-u78qioxne7 div { box-sizing: content-box; }
82
+ /* generated by https://loading.io/ */
83
+ </style></body></html>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
3
+ <g transform="translate(50 50)"> <g transform="translate(-17 -17) scale(0.5)"> <g>
4
+ <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.4545454545454546s" begin="0s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#86b817"></path></g></g> <g transform="translate(0 22) scale(0.4)"> <g>
5
+ <animateTransform attributeName="transform" type="rotate" values="45;0" keyTimes="0;1" dur="0.4545454545454546s" begin="-0.2272727272727273s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#e53238"></path></g></g> <g transform="translate(28 4) scale(0.3)"> <g>
6
+ <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.4545454545454546s" begin="-0.2272727272727273s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#f5af02"></path></g></g></g>
7
+ <!-- [ldio] generated by https://loading.io/ --></svg>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
3
+ <g transform="translate(50 50)"> <g transform="translate(-17 -17) scale(0.5)"> <g>
4
+ <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.4545454545454546s" begin="0s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#85a2b6"></path></g></g> <g transform="translate(0 22) scale(0.4)"> <g>
5
+ <animateTransform attributeName="transform" type="rotate" values="45;0" keyTimes="0;1" dur="0.4545454545454546s" begin="-0.2272727272727273s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#bbcedd"></path></g></g> <g transform="translate(28 4) scale(0.3)"> <g>
6
+ <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.4545454545454546s" begin="-0.2272727272727273s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#dce4eb"></path></g></g></g>
7
+ <!-- [ldio] generated by https://loading.io/ --></svg>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
3
+ <g transform="translate(50 50)"> <g transform="translate(-17 -17) scale(0.5)"> <g>
4
+ <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.4545454545454546s" begin="0s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#353535"></path></g></g> <g transform="translate(0 22) scale(0.4)"> <g>
5
+ <animateTransform attributeName="transform" type="rotate" values="45;0" keyTimes="0;1" dur="0.4545454545454546s" begin="-0.2272727272727273s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#666666"></path></g></g> <g transform="translate(28 4) scale(0.3)"> <g>
6
+ <animateTransform attributeName="transform" type="rotate" values="0;45" keyTimes="0;1" dur="0.4545454545454546s" begin="-0.2272727272727273s" repeatCount="indefinite"></animateTransform><path d="M37.3496987939662 -7 L47.3496987939662 -7 L47.3496987939662 7 L37.3496987939662 7 A38 38 0 0 1 31.359972760794346 21.46047782418268 L31.359972760794346 21.46047782418268 L38.431040572659825 28.531545636048154 L28.531545636048154 38.431040572659825 L21.46047782418268 31.359972760794346 A38 38 0 0 1 7.0000000000000036 37.3496987939662 L7.0000000000000036 37.3496987939662 L7.000000000000004 47.3496987939662 L-6.999999999999999 47.3496987939662 L-7 37.3496987939662 A38 38 0 0 1 -21.46047782418268 31.35997276079435 L-21.46047782418268 31.35997276079435 L-28.531545636048154 38.431040572659825 L-38.43104057265982 28.531545636048158 L-31.359972760794346 21.460477824182682 A38 38 0 0 1 -37.3496987939662 7.000000000000007 L-37.3496987939662 7.000000000000007 L-47.3496987939662 7.000000000000008 L-47.3496987939662 -6.9999999999999964 L-37.3496987939662 -6.999999999999997 A38 38 0 0 1 -31.35997276079435 -21.460477824182675 L-31.35997276079435 -21.460477824182675 L-38.431040572659825 -28.531545636048147 L-28.53154563604818 -38.4310405726598 L-21.4604778241827 -31.35997276079433 A38 38 0 0 1 -6.999999999999992 -37.3496987939662 L-6.999999999999992 -37.3496987939662 L-6.999999999999994 -47.3496987939662 L6.999999999999977 -47.3496987939662 L6.999999999999979 -37.3496987939662 A38 38 0 0 1 21.460477824182686 -31.359972760794342 L21.460477824182686 -31.359972760794342 L28.531545636048158 -38.43104057265982 L38.4310405726598 -28.53154563604818 L31.35997276079433 -21.4604778241827 A38 38 0 0 1 37.3496987939662 -6.999999999999995 M0 -23A23 23 0 1 0 0 23 A23 23 0 1 0 0 -23" fill="#9b9b9b"></path></g></g></g>
7
+ <!-- [ldio] generated by https://loading.io/ --></svg>
@@ -0,0 +1,101 @@
1
+ import { pathToRegexp, match } from 'path-to-regexp';
2
+ import _ from 'lodash';
3
+
4
+ export default {
5
+ // Map a parent path to the sub app's url based on sub app declaration
6
+ getChildUrlPath(subApp) {
7
+ const parentPath = document.location.href.replace(document.location.origin, '');
8
+
9
+ // The subApp.path means under which path pattern it loads the sub app.
10
+ // It needs to extract params from subApp.path and used to construct the final sub app url.
11
+ const res = match(subApp.path, { decode: decodeURIComponent, end: false })(parentPath);
12
+ console.log(subApp.path, parentPath, res);
13
+ if (res) {
14
+ // Join childUrl with parent path
15
+ // Example:
16
+ // subApp.url: https://cloud.ebay.com/full-ecdx-page/<%=appName%>
17
+ // subApp.path: /app/:appName/ecdx
18
+ // parentPath: /app/musemanager/ecdx/sub-tab?query=1
19
+ // => childBaseUrl: https://cloud.ebay.com/full-ecdx-page/musemanager
20
+ // => childUrlPath: /full-ecdx-page/musemanager/sub-tab?query=1
21
+
22
+ // Get the sub app base url
23
+ const childBaseUrl = _.template(subApp.url)(res.params);
24
+
25
+ // const urlInstance = new URL(childBaseUrl);
26
+
27
+ let u = parentPath.replace(pathToRegexp(subApp.path, [], { end: false }), '');
28
+ // if (!u.startsWith('/')) u = '/' + u;
29
+ const arr = childBaseUrl.split('/');
30
+ arr.splice(0, 3);
31
+ let s = arr.join('/').replace(/\/*$/, '') + u;
32
+ if (!s.startsWith('/')) s = '/' + s;
33
+ console.log('childUrlPath: ', s);
34
+ return s;
35
+ }
36
+ return null;
37
+ },
38
+
39
+ /*
40
+ Get the parent full path by the sub app's full path. Only supports one sub app a time.
41
+ Example:
42
+ parentUrl: https://admin.musejs.com/app/musemanager/ecdx/sub-tab?query=1
43
+ subApp.path: /app/:appName/ecdx
44
+ subApp.url: https://local.musejs.com:3030/full-ecdx-page/:appName
45
+ childFullPath: /fullpage-ecdx-page/musemanager/sub-tab?query=1
46
+ parentPath: /app/musemanager/ecdx/sub-tab?query=1
47
+ */
48
+ getParentPath(childFullPath, subApp) {
49
+ const parentPath = document.location.href.replace(document.location.origin, '');
50
+ const res = match(subApp.path, { decode: decodeURIComponent, end: false })(parentPath);
51
+
52
+ // The parent path must match subApp.path
53
+ if (!res) return null;
54
+ const childBaseUrl = _.template(subApp.url)(res.params);
55
+
56
+ // mountedSubPath is the path defined in subApp.url, for example:
57
+ // - https://subapp.musejs.org/foo/bar => /foo/bar
58
+ // - https://subapp.musejs.org => '/'
59
+ console.log('child full path: ', childFullPath, subApp);
60
+ // TODO: get the real child url which has processed params
61
+ const mountedSubPath = '/' + childBaseUrl.split('/').slice(3).join('/');
62
+ console.log('mountedSubPath: ', mountedSubPath);
63
+ // If the sub app go out of the registered mounted path, do nothing. This is usually due to a un-well design.
64
+ // /foo - '/' => valid
65
+ // /foo - /foo => valid
66
+ // /foo?query - /foo => valid
67
+ // /foo#hash - /foo => valid
68
+ // /foo/bar - /foo => valid
69
+ // /xxx - /foo => invalid
70
+ // /foo/bar - /foo => valid
71
+ // /bar - /foo => invalid
72
+ const isPathValid =
73
+ mountedSubPath === '/' ||
74
+ (childFullPath.startsWith(mountedSubPath) &&
75
+ ['', '?', '/', '#'].includes(childFullPath.charAt(mountedSubPath.length)));
76
+ if (!isPathValid) return;
77
+ const re = pathToRegexp(subApp.path, [], { end: false });
78
+ const pathname = document.location.pathname;
79
+ if (!re.test(pathname)) return;
80
+ const m = pathname.match(re);
81
+ console.log('parent register path: ', m[0]);
82
+ const newParentFullPath = (
83
+ m[0] +
84
+ // '/' +
85
+ // childFullPath = '/', mountedSubPath='/' => ''
86
+ // childFullPath = '/abc', mountedSubPath='/' => 'abc'
87
+ // childFullPath = '/abc', mountedSubPath='/abc' => ''
88
+ // childFullPath = '/abc/def', mountedSubPath='/abc' => '/def'
89
+ childFullPath.replace(mountedSubPath, '')
90
+ )
91
+ .replace(/\/+/g, '/')
92
+ .replace(/\/$/, '');
93
+ console.log('newParentFullPath: ', newParentFullPath);
94
+ return newParentFullPath;
95
+ },
96
+ getOrigin(url) {
97
+ const arr = url.split('/');
98
+ arr.length = 3;
99
+ return arr.join('/');
100
+ },
101
+ };
Binary file
package/src/index.css ADDED
@@ -0,0 +1,3 @@
1
+ body {
2
+ color: red;
3
+ }
package/src/index.js ADDED
@@ -0,0 +1,41 @@
1
+ // This is the plugin index, register plugin and load styles or other resources here.
2
+
3
+ import React from 'react';
4
+ import { createRoot } from 'react-dom/client';
5
+ import Root from './Root';
6
+ import plugin from 'js-plugin';
7
+ import Loadable from 'react-loadable';
8
+ import _ from 'lodash';
9
+ import * as reactUse from 'react-use';
10
+ import './styles/index.less';
11
+ import * as reactRouterDom from 'react-router-dom';
12
+ import * as reactQuery from '@tanstack/react-query';
13
+
14
+ plugin.register({
15
+ name: '@ebay/muse-lib-react', // reserve the plugin name
16
+ });
17
+
18
+ const renderApp = () => {
19
+ let rootNode = document.getElementById('muse-react-root');
20
+ if (!rootNode) {
21
+ rootNode = document.createElement('div');
22
+ rootNode.id = 'muse-react-root';
23
+ document.body.appendChild(rootNode);
24
+ }
25
+ rootNode.innerHTML = '';
26
+ plugin.invoke('root.beforeRender');
27
+ const root = createRoot(rootNode);
28
+ // Plugin can do some initialization before app render.
29
+ window.__js_plugin = plugin; // Mainly for debugging
30
+ root.render(<Root />);
31
+ plugin.invoke('root.afterRender');
32
+
33
+ plugin.invoke('onReady');
34
+ };
35
+
36
+ window.MUSE_GLOBAL.appEntries.push({
37
+ name: '@ebay/muse-lib-react',
38
+ func: renderApp,
39
+ });
40
+
41
+ export default { Loadable, _, reactUse, reactRouterDom, reactQuery };
@@ -0,0 +1 @@
1
+
package/src/muse.d.ts ADDED
@@ -0,0 +1,163 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ import { Reducer, AnyAction } from 'redux';
3
+
4
+ /**
5
+ * A component(provider) wraps the root element of the application.
6
+ * For example Redux provider, Router provider, etc.
7
+ */
8
+ type ProviderType = {
9
+ // The order of the provider, the smaller the number, the higher the priority.
10
+ order: number;
11
+ // The key of the provider.
12
+ key: string;
13
+ // The provider component.
14
+ provider: React.ComponentType<any> | null;
15
+ // The props passed to the provider.
16
+ props?: Record<string, any> | null;
17
+ // How to render the wrapped children.
18
+ renderProvider?: ((children: React.ReactNode) => React.ReactNode) | null;
19
+ };
20
+
21
+ /**
22
+ * The interface to process providers.
23
+ */
24
+ interface ProvidersContextType {
25
+ providers: ProviderType[];
26
+ }
27
+
28
+ /**
29
+ * @description
30
+ * The `root` extension point type.
31
+ * @museExt
32
+ */
33
+ export interface RootExtPoints {
34
+ /**
35
+ * Called before the root element is rendered.
36
+ */
37
+ beforeRender?: Function;
38
+ /**
39
+ * Called after the root element is rendered.
40
+ */
41
+ afterRender?: Function;
42
+
43
+ /**
44
+ * Render a wrapper component to the root element. This is often used to inject providers.
45
+ * But usually you can use getProviders instead.
46
+ */
47
+ renderChildren?: () => void;
48
+
49
+ /**
50
+ * Pre-process providers. This is called before providers are collected by getProviders.
51
+ * Sometimes you want to disable some internal providers, just remove it from the context.
52
+ */
53
+ preProcessProviders?: (context: { providers: ProviderType[] }) => string | boolean;
54
+
55
+ /**
56
+ * Get providers, you can return a single provider or an array of providers or nothing.
57
+ */
58
+ getProviders?: (context: ProvidersContextType) => ProviderType | ProviderType[] | void;
59
+
60
+ /**
61
+ * After all providers from `getProviders` are collected, you can process them here.
62
+ */
63
+ processProviders?: (context: ProvidersContextType) => string | void;
64
+
65
+ /**
66
+ * Called after processProviders, another opportunity to process providers.
67
+ */
68
+ postProcessProviders?: (context: ProvidersContextType) => void;
69
+ }
70
+
71
+ /**
72
+ * @museExt
73
+ */
74
+ export interface HomeExtPoints {
75
+ /**
76
+ * The main layout of the application. Use this extpoint need to undeploy @ebay/muse-layout-antd.
77
+ */
78
+ mainLayout?: ComponentType;
79
+
80
+ /**
81
+ * The homepage component of the applicaiton. That is, the component under root route "/".
82
+ */
83
+ homepage?: ComponentType;
84
+ }
85
+
86
+ /**
87
+ * @category Ext Points Route
88
+ */
89
+ export interface MuseRoute {
90
+ id?: string;
91
+ path?: string | Array<string>;
92
+ component?: ComponentType;
93
+ element: ReactNode;
94
+ childRoutes?: MuseRoute[];
95
+ isIndex?: boolean;
96
+ index?: boolean;
97
+ render?: Function;
98
+ parent?: string;
99
+ [key: string]: unknown;
100
+ }
101
+
102
+ /**
103
+ * @museExt #root
104
+ */
105
+ export default interface MuseLibReactExtPoints {
106
+ /**
107
+ * Route definitions
108
+ * ```ts
109
+ * factorial(1)
110
+ * ```
111
+ * @example
112
+ * If there is a code block, then both TypeDoc and VSCode will treat
113
+ * text outside of the code block as regular text.
114
+ * ```ts
115
+ * factorial(1)
116
+ * ```
117
+ */
118
+ route?: MuseRoute | MuseRoute[];
119
+
120
+ /**
121
+ * Called after the application is mounted to the DOM (React root elemented rendered)
122
+ */
123
+ onReady?: Function;
124
+
125
+ /**
126
+ * root extension point
127
+ */
128
+ root?: RootExtPoints;
129
+
130
+ /**
131
+ * Merge additional props passed Router component directly.
132
+ */
133
+ routerProps?: Record<string, any>;
134
+
135
+ /**
136
+ * home extension point
137
+ */
138
+ home?: HomeExtPoints;
139
+
140
+ testPoint?: {
141
+ ab: {
142
+ cd: () => {};
143
+ };
144
+ test: string;
145
+ };
146
+
147
+ /**
148
+ * You can render an empty component to the app root after app started.
149
+ * It's mainly used for some initialization logic.
150
+ * NOTE: you should not render any UI content in the component, just return null.
151
+ */
152
+ rootComponent?: ComponentType;
153
+
154
+ /**
155
+ * Redux store extension point, contribute a plugin level reducer.
156
+ */
157
+ reducer?: Reducer<any, AnyAction>;
158
+
159
+ /**
160
+ * Redux store extension point, contribute root level reducers.
161
+ */
162
+ reducers?: Record<string, Reducer<any, AnyAction>>;
163
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="react-scripts" />
@@ -0,0 +1,9 @@
1
+ @import './mixins';
2
+
3
+ // Here you put all global css rules.
4
+
5
+ body {
6
+ margin: 0;
7
+ padding: 0;
8
+ font-family: sans-serif;
9
+ }
@@ -0,0 +1,5 @@
1
+ // index is the entry for all styles.
2
+ @import './global';
3
+ @import '../features/home/style';
4
+ @import '../features/common/style';
5
+ @import '../features/sub-app/style';
File without changes
package/src/utils.js ADDED
@@ -0,0 +1,26 @@
1
+ import jsPlugin from 'js-plugin';
2
+ import _ from 'lodash';
3
+
4
+ function capitalizeFirstLetter(string) {
5
+ return string.charAt(0).toUpperCase() + string.slice(1);
6
+ }
7
+
8
+ /**
9
+ * @description Make an array extensible by js plugins.
10
+ * @param {*} arr
11
+ * @param {*} extName
12
+ * @param {*} extBase
13
+ * @param {...any} args
14
+ */
15
+ export const extendArray = (arr, extName, extBase, ...args) => {
16
+ const capitalName = capitalizeFirstLetter(extName);
17
+ jsPlugin.invoke(`${extBase}.preProcess${capitalName}`, ...args);
18
+ const items = _.flatten(jsPlugin.invoke(`${extBase}.get${capitalName}`, ...args));
19
+ arr.push(...items);
20
+ jsPlugin.invoke(`${extBase}.process${capitalName}`, ...args);
21
+ jsPlugin.invoke(`${extBase}.postProcess${capitalName}`, ...args);
22
+ jsPlugin.sort(arr);
23
+ return arr;
24
+ };
25
+
26
+ export default { extendArray };