@elliemae/pui-app-sdk 2.17.1 → 3.0.0-beta.10

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 (397) hide show
  1. package/dist/cjs/analytics/appdynamics.js +34 -30
  2. package/dist/cjs/analytics/index.js +32 -26
  3. package/dist/cjs/analytics/page-view-event.js +34 -30
  4. package/dist/cjs/analytics/user-session-event.js +34 -27
  5. package/dist/cjs/analytics/user-wait-event.js +31 -17
  6. package/dist/cjs/analytics/web-analytics.js +16 -19
  7. package/dist/cjs/api/auth/index.js +41 -39
  8. package/dist/cjs/api/helpers.js +33 -99
  9. package/dist/cjs/api/users/index.js +28 -16
  10. package/dist/cjs/communication/http-client/index.js +44 -48
  11. package/dist/cjs/communication/http-client/request-interceptor.js +28 -12
  12. package/dist/cjs/communication/http-client/response-interceptor.js +41 -38
  13. package/dist/cjs/communication/http-client/retry-axios.js +68 -122
  14. package/dist/cjs/communication/http-client/retry.js +42 -36
  15. package/dist/cjs/communication/http-client/tests/index.test-disable.js +48 -56
  16. package/dist/cjs/data/auth/actions.js +17 -26
  17. package/dist/cjs/data/auth/reducer.js +30 -18
  18. package/dist/cjs/data/breakpoint/index.js +38 -32
  19. package/dist/cjs/data/error/index.js +33 -18
  20. package/dist/cjs/data/index.js +34 -0
  21. package/dist/cjs/data/live-message/index.js +34 -25
  22. package/dist/cjs/data/logout/actions.js +12 -9
  23. package/dist/cjs/data/navigation-prompt/actions.js +12 -9
  24. package/dist/cjs/data/react-redux.js +29 -13
  25. package/dist/cjs/data/reducers.js +35 -23
  26. package/dist/cjs/data/saga.js +12 -9
  27. package/dist/cjs/data/store.js +52 -60
  28. package/dist/cjs/data/wait-message/actions.js +14 -13
  29. package/dist/cjs/data/wait-message/reducer.js +32 -24
  30. package/dist/cjs/index.js +189 -809
  31. package/dist/cjs/micro-frontend.js +33 -0
  32. package/dist/cjs/route/index.js +38 -32
  33. package/dist/cjs/route/page-view.js +30 -22
  34. package/dist/cjs/route/private-route/index.js +53 -60
  35. package/dist/cjs/sideeffect/auth/index.js +42 -30
  36. package/dist/cjs/sideeffect/error-toast/index.js +39 -26
  37. package/dist/cjs/sideeffect/wait-message/index.js +45 -29
  38. package/dist/cjs/typings/custom.d.js +0 -1
  39. package/dist/cjs/typings/elliemae.d.js +0 -1
  40. package/dist/cjs/typings/styled.d.js +19 -3
  41. package/dist/cjs/utils/app-config/config.js +33 -33
  42. package/dist/cjs/utils/app-config/index.js +42 -44
  43. package/dist/cjs/utils/app-host-integration/react.js +27 -14
  44. package/dist/cjs/utils/auth/helper.js +30 -18
  45. package/dist/cjs/utils/auth/index.js +76 -116
  46. package/dist/cjs/utils/await.js +3 -0
  47. package/dist/cjs/utils/constants.js +22 -21
  48. package/dist/cjs/utils/font-size.js +13 -14
  49. package/dist/cjs/utils/guest-with-service.js +11 -12
  50. package/dist/cjs/utils/helpers.js +15 -19
  51. package/dist/cjs/utils/history.js +29 -12
  52. package/dist/cjs/utils/log-records.js +38 -35
  53. package/dist/cjs/utils/micro-frontend/console-logger.js +39 -23
  54. package/dist/cjs/utils/micro-frontend/guest.js +80 -128
  55. package/dist/cjs/utils/micro-frontend/host.js +84 -124
  56. package/dist/cjs/utils/micro-frontend/index.js +60 -61
  57. package/dist/cjs/utils/micro-frontend/types.js +3 -5
  58. package/dist/cjs/utils/redact-pii.js +15 -17
  59. package/dist/cjs/utils/service-worker.js +36 -21
  60. package/dist/cjs/utils/session.js +64 -70
  61. package/dist/cjs/utils/storybook/cjs/main.js +53 -0
  62. package/dist/cjs/utils/storybook/cjs/middleware.js +5 -0
  63. package/dist/cjs/utils/storybook/cjs/vite.js +6 -0
  64. package/dist/cjs/utils/storybook/cjs/webpack.js +21 -0
  65. package/dist/cjs/utils/storybook/manager.js +31 -16
  66. package/dist/cjs/utils/storybook/preview.js +58 -50
  67. package/dist/cjs/utils/storybook/theme.js +30 -14
  68. package/dist/cjs/utils/testing/index.js +39 -50
  69. package/dist/cjs/utils/testing/render-with-redux.js +35 -27
  70. package/dist/cjs/utils/testing/render-with-router-redux.js +41 -37
  71. package/dist/cjs/utils/testing/render-with-router.js +35 -28
  72. package/dist/cjs/utils/testing/render-with-state-addons.js +41 -36
  73. package/dist/cjs/utils/types.js +3 -0
  74. package/dist/cjs/utils/url.js +12 -13
  75. package/dist/cjs/utils/web-storage.js +40 -30
  76. package/dist/cjs/utils/window.js +36 -28
  77. package/dist/cjs/view/app-root/hosted-app.js +36 -32
  78. package/dist/cjs/view/app-root/index.js +58 -62
  79. package/dist/cjs/view/app-root/stand-alone-app.js +39 -37
  80. package/dist/cjs/view/app-root/style.js +50 -12
  81. package/dist/cjs/view/error-boundary/default-error-template.js +27 -15
  82. package/dist/cjs/view/error-boundary/index.js +41 -43
  83. package/dist/cjs/view/error-toast/index.js +43 -32
  84. package/dist/cjs/view/fetch-host-app-data/index.js +34 -26
  85. package/dist/cjs/view/fetch-host-app-data/store.js +31 -24
  86. package/dist/cjs/view/fields/check-box/index.js +35 -39
  87. package/dist/cjs/view/fields/combo-box/index.js +38 -31
  88. package/dist/cjs/view/fields/connect-form.js +30 -15
  89. package/dist/cjs/view/fields/date-input/index.js +35 -26
  90. package/dist/cjs/view/fields/date-picker/index.js +35 -26
  91. package/dist/cjs/view/fields/form-item-layout/index.js +37 -30
  92. package/dist/cjs/view/fields/input-mask/index.js +36 -41
  93. package/dist/cjs/view/fields/large-text-box/index.js +35 -26
  94. package/dist/cjs/view/fields/radio/index.js +35 -30
  95. package/dist/cjs/view/fields/radio-group/index.js +33 -27
  96. package/dist/cjs/view/fields/text-box/index.js +35 -26
  97. package/dist/cjs/view/fields/watch-value.js +42 -35
  98. package/dist/cjs/view/form/index.js +42 -34
  99. package/dist/cjs/view/form/personal-info-section.js +57 -80
  100. package/dist/cjs/view/form/submit-button/index.js +35 -23
  101. package/dist/cjs/view/guest-unload-handlers/index.js +33 -22
  102. package/dist/cjs/view/header/center-region/index.js +62 -38
  103. package/dist/cjs/view/header/index.js +42 -35
  104. package/dist/cjs/view/header/logo-region/index.js +32 -23
  105. package/dist/cjs/view/header/nav-region/index.js +45 -30
  106. package/dist/cjs/view/header/nav-region/notification/index.js +29 -18
  107. package/dist/cjs/view/header/nav-region/user/index.js +29 -18
  108. package/dist/cjs/view/host-binding-events/index.js +10 -11
  109. package/dist/cjs/view/intro.stories.mdx +1 -1
  110. package/dist/cjs/view/live-message/index.js +34 -34
  111. package/dist/cjs/view/loadable/index.js +34 -27
  112. package/dist/cjs/view/login/index.js +37 -30
  113. package/dist/cjs/view/media-breakpoint/index.js +44 -34
  114. package/dist/cjs/view/message-to-host-app/index.js +31 -20
  115. package/dist/cjs/view/micro-app/app-factory/index.js +100 -134
  116. package/dist/cjs/view/micro-app/const.js +10 -7
  117. package/dist/cjs/view/micro-app/index.js +38 -27
  118. package/dist/cjs/view/micro-app/resources/manifest.js +43 -34
  119. package/dist/cjs/view/micro-app/resources/script.js +56 -53
  120. package/dist/cjs/view/micro-app/resources/style.js +44 -38
  121. package/dist/cjs/view/micro-app/types.js +3 -5
  122. package/dist/cjs/view/micro-app/use-app-will-render.js +58 -50
  123. package/dist/cjs/view/micro-app/utils.js +32 -21
  124. package/dist/cjs/view/micro-iframe-app/app.js +38 -39
  125. package/dist/cjs/view/micro-iframe-app/iframe/const.js +10 -7
  126. package/dist/cjs/view/micro-iframe-app/iframe/index.js +52 -47
  127. package/dist/cjs/view/micro-iframe-app/index.js +37 -24
  128. package/dist/cjs/view/micro-iframe-app/types.js +3 -5
  129. package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +42 -36
  130. package/dist/cjs/view/modals/error/index.js +36 -28
  131. package/dist/cjs/view/modals/navigation-prompt/index.js +39 -37
  132. package/dist/cjs/view/modals/session-expiry/customHooks.js +40 -35
  133. package/dist/cjs/view/modals/session-expiry/index.js +46 -50
  134. package/dist/cjs/view/modals/wait-message/html-wait-message.js +33 -18
  135. package/dist/cjs/view/modals/wait-message/index.js +51 -53
  136. package/dist/cjs/view/modals/wait-message/wait-message-launcher.js +34 -21
  137. package/dist/cjs/view/render-with-delay/index.js +31 -19
  138. package/dist/cjs/view/render-with-host-data/index.js +36 -30
  139. package/dist/cjs/view/session-timeout/index.js +45 -35
  140. package/dist/cjs/view/storybook/decorator.js +33 -21
  141. package/dist/cjs/view/use-previous.js +29 -13
  142. package/dist/cjs/view/useMediaBreakpoints/index.js +34 -19
  143. package/dist/cjs/view/visually-hidden/index.js +42 -21
  144. package/dist/cjs/view/window-size/index.js +35 -22
  145. package/dist/es/analytics/appdynamics.js +14 -15
  146. package/dist/es/analytics/index.js +8 -14
  147. package/dist/es/analytics/page-view-event.js +11 -21
  148. package/dist/es/analytics/user-session-event.js +11 -13
  149. package/dist/es/analytics/user-wait-event.js +9 -5
  150. package/dist/es/analytics/web-analytics.js +12 -10
  151. package/dist/es/api/auth/index.js +21 -26
  152. package/dist/es/api/helpers.js +8 -81
  153. package/dist/es/api/users/index.js +6 -7
  154. package/dist/es/communication/http-client/index.js +19 -25
  155. package/dist/es/communication/http-client/request-interceptor.js +5 -2
  156. package/dist/es/communication/http-client/response-interceptor.js +20 -21
  157. package/dist/es/communication/http-client/retry-axios.js +45 -105
  158. package/dist/es/communication/http-client/retry.js +22 -25
  159. package/dist/es/communication/http-client/tests/index.test-disable.js +25 -44
  160. package/dist/es/data/auth/actions.js +13 -19
  161. package/dist/es/data/auth/reducer.js +8 -6
  162. package/dist/es/data/breakpoint/index.js +19 -21
  163. package/dist/es/data/error/index.js +11 -9
  164. package/dist/es/data/index.js +11 -0
  165. package/dist/es/data/live-message/index.js +12 -16
  166. package/dist/es/data/logout/actions.js +9 -5
  167. package/dist/es/data/navigation-prompt/actions.js +9 -5
  168. package/dist/es/data/react-redux.js +7 -3
  169. package/dist/es/data/reducers.js +6 -3
  170. package/dist/es/data/saga.js +8 -5
  171. package/dist/es/data/store.js +25 -43
  172. package/dist/es/data/wait-message/actions.js +11 -9
  173. package/dist/es/data/wait-message/reducer.js +9 -9
  174. package/dist/es/index.js +192 -83
  175. package/dist/es/micro-frontend.js +10 -0
  176. package/dist/es/route/index.js +16 -18
  177. package/dist/es/route/page-view.js +8 -8
  178. package/dist/es/route/private-route/index.js +24 -31
  179. package/dist/es/sideeffect/auth/index.js +24 -11
  180. package/dist/es/sideeffect/error-toast/index.js +11 -10
  181. package/dist/es/sideeffect/wait-message/index.js +14 -10
  182. package/dist/es/typings/styled.d.js +1 -1
  183. package/dist/es/utils/app-config/config.js +11 -9
  184. package/dist/es/utils/app-config/index.js +17 -27
  185. package/dist/es/utils/app-host-integration/react.js +8 -6
  186. package/dist/es/utils/auth/helper.js +7 -3
  187. package/dist/es/utils/auth/index.js +51 -75
  188. package/dist/es/utils/constants.js +18 -13
  189. package/dist/es/utils/font-size.js +7 -3
  190. package/dist/es/utils/guest-with-service.js +6 -7
  191. package/dist/es/utils/helpers.js +10 -6
  192. package/dist/es/utils/history.js +7 -3
  193. package/dist/es/utils/log-records.js +34 -31
  194. package/dist/es/utils/micro-frontend/console-logger.js +16 -12
  195. package/dist/es/utils/micro-frontend/guest.js +44 -100
  196. package/dist/es/utils/micro-frontend/host.js +41 -77
  197. package/dist/es/utils/micro-frontend/index.js +35 -33
  198. package/dist/es/utils/micro-frontend/types.js +0 -1
  199. package/dist/es/utils/redact-pii.js +10 -11
  200. package/dist/es/utils/service-worker.js +13 -10
  201. package/dist/es/utils/session.js +45 -46
  202. package/dist/es/utils/storybook/manager.js +7 -4
  203. package/dist/es/utils/storybook/preview.js +27 -24
  204. package/dist/es/utils/storybook/theme.js +9 -6
  205. package/dist/es/utils/testing/index.js +12 -18
  206. package/dist/es/utils/testing/render-with-redux.js +12 -11
  207. package/dist/es/utils/testing/render-with-router-redux.js +18 -19
  208. package/dist/es/utils/testing/render-with-router.js +15 -16
  209. package/dist/es/utils/testing/render-with-state-addons.js +19 -18
  210. package/dist/es/utils/url.js +7 -3
  211. package/dist/es/utils/web-storage.js +21 -17
  212. package/dist/es/utils/window.js +18 -18
  213. package/dist/es/view/app-root/hosted-app.js +10 -13
  214. package/dist/es/view/app-root/index.js +29 -33
  215. package/dist/es/view/app-root/stand-alone-app.js +11 -12
  216. package/dist/es/view/app-root/style.js +30 -5
  217. package/dist/es/view/error-boundary/default-error-template.js +5 -5
  218. package/dist/es/view/error-boundary/index.js +18 -25
  219. package/dist/es/view/error-toast/index.js +15 -14
  220. package/dist/es/view/fetch-host-app-data/index.js +14 -11
  221. package/dist/es/view/fetch-host-app-data/store.js +10 -7
  222. package/dist/es/view/fields/check-box/index.js +17 -18
  223. package/dist/es/view/fields/combo-box/index.js +20 -19
  224. package/dist/es/view/fields/connect-form.js +8 -6
  225. package/dist/es/view/fields/date-input/index.js +17 -14
  226. package/dist/es/view/fields/date-picker/index.js +17 -14
  227. package/dist/es/view/fields/form-item-layout/index.js +15 -15
  228. package/dist/es/view/fields/input-mask/index.js +21 -14
  229. package/dist/es/view/fields/large-text-box/index.js +17 -14
  230. package/dist/es/view/fields/radio/index.js +17 -18
  231. package/dist/es/view/fields/radio-group/index.js +15 -15
  232. package/dist/es/view/fields/text-box/index.js +17 -14
  233. package/dist/es/view/fields/watch-value.js +20 -24
  234. package/dist/es/view/form/index.js +23 -22
  235. package/dist/es/view/form/personal-info-section.js +28 -48
  236. package/dist/es/view/form/submit-button/index.js +13 -10
  237. package/dist/es/view/guest-unload-handlers/index.js +10 -9
  238. package/dist/es/view/header/center-region/index.js +41 -23
  239. package/dist/es/view/header/index.js +16 -15
  240. package/dist/es/view/header/logo-region/index.js +10 -10
  241. package/dist/es/view/header/nav-region/index.js +21 -13
  242. package/dist/es/view/header/nav-region/notification/index.js +7 -7
  243. package/dist/es/view/header/nav-region/user/index.js +7 -7
  244. package/dist/es/view/host-binding-events/index.js +7 -3
  245. package/dist/es/view/intro.stories.mdx +1 -1
  246. package/dist/es/view/live-message/index.js +13 -22
  247. package/dist/es/view/loadable/index.js +13 -15
  248. package/dist/es/view/login/index.js +12 -15
  249. package/dist/es/view/media-breakpoint/index.js +16 -13
  250. package/dist/es/view/message-to-host-app/index.js +10 -9
  251. package/dist/es/view/micro-app/app-factory/index.js +67 -81
  252. package/dist/es/view/micro-app/const.js +4 -1
  253. package/dist/es/view/micro-app/index.js +12 -9
  254. package/dist/es/view/micro-app/resources/manifest.js +17 -15
  255. package/dist/es/view/micro-app/resources/script.js +35 -35
  256. package/dist/es/view/micro-app/resources/style.js +22 -21
  257. package/dist/es/view/micro-app/types.js +0 -1
  258. package/dist/es/view/micro-app/use-app-will-render.js +35 -26
  259. package/dist/es/view/micro-app/utils.js +11 -13
  260. package/dist/es/view/micro-iframe-app/app.js +14 -20
  261. package/dist/es/view/micro-iframe-app/iframe/const.js +4 -1
  262. package/dist/es/view/micro-iframe-app/iframe/index.js +27 -31
  263. package/dist/es/view/micro-iframe-app/index.js +10 -10
  264. package/dist/es/view/micro-iframe-app/types.js +0 -1
  265. package/dist/es/view/micro-iframe-app/use-frame-loaded.js +15 -18
  266. package/dist/es/view/modals/error/index.js +13 -10
  267. package/dist/es/view/modals/navigation-prompt/index.js +11 -14
  268. package/dist/es/view/modals/session-expiry/customHooks.js +11 -13
  269. package/dist/es/view/modals/session-expiry/index.js +13 -20
  270. package/dist/es/view/modals/wait-message/html-wait-message.js +11 -10
  271. package/dist/es/view/modals/wait-message/index.js +30 -37
  272. package/dist/es/view/modals/wait-message/wait-message-launcher.js +8 -6
  273. package/dist/es/view/render-with-delay/index.js +8 -10
  274. package/dist/es/view/render-with-host-data/index.js +10 -13
  275. package/dist/es/view/session-timeout/index.js +19 -9
  276. package/dist/es/view/storybook/decorator.js +8 -5
  277. package/dist/es/view/use-previous.js +6 -3
  278. package/dist/es/view/useMediaBreakpoints/index.js +11 -9
  279. package/dist/es/view/visually-hidden/index.js +20 -10
  280. package/dist/es/view/window-size/index.js +12 -10
  281. package/dist/types/communication/http-client/retry.d.ts +1 -1
  282. package/dist/types/data/index.d.ts +4 -0
  283. package/dist/types/data/react-redux.d.ts +11 -11
  284. package/dist/types/data/reducers.d.ts +6 -6
  285. package/dist/types/data/store.d.ts +29 -29
  286. package/dist/types/index.d.ts +79 -79
  287. package/dist/types/micro-frontend.d.ts +6 -0
  288. package/dist/types/route/private-route/index.d.ts +1 -1
  289. package/dist/types/sideeffect/auth/index.d.ts +1 -1
  290. package/dist/types/utils/app-host-integration/react.d.ts +1 -1
  291. package/dist/types/utils/micro-frontend/guest.d.ts +3 -3
  292. package/dist/types/utils/micro-frontend/host.d.ts +1 -1
  293. package/dist/types/utils/micro-frontend/index.d.ts +2 -2
  294. package/dist/types/utils/micro-frontend/types.d.ts +1 -1
  295. package/dist/types/utils/storybook/cjs/main.d.ts +63 -0
  296. package/dist/types/utils/storybook/{middleware.d.ts → cjs/middleware.d.ts} +0 -0
  297. package/dist/types/utils/storybook/cjs/vite.d.ts +4 -0
  298. package/dist/types/utils/storybook/cjs/webpack.d.ts +16 -0
  299. package/dist/types/utils/storybook/preview.d.ts +9 -3
  300. package/dist/types/utils/testing/render-with-redux.d.ts +20 -20
  301. package/dist/types/utils/testing/render-with-router-redux.d.ts +20 -20
  302. package/dist/types/utils/window.d.ts +1 -1
  303. package/dist/types/view/app-root/index.d.ts +1 -1
  304. package/dist/types/view/fields/check-box/index.d.ts +1 -1
  305. package/dist/types/view/fields/check-box/index.stories.d.ts +1 -1
  306. package/dist/types/view/fields/check-box/set-value.stories.d.ts +1 -1
  307. package/dist/types/view/fields/combo-box/index.stories.d.ts +1 -1
  308. package/dist/types/view/fields/date-input/index.stories.d.ts +1 -1
  309. package/dist/types/view/fields/date-picker/index.stories.d.ts +1 -1
  310. package/dist/types/view/fields/form-item-layout/index.stories.d.ts +1 -1
  311. package/dist/types/view/fields/input-mask/index.d.ts +1 -1
  312. package/dist/types/view/fields/input-mask/index.stories.d.ts +1 -1
  313. package/dist/types/view/fields/large-text-box/index.stories.d.ts +1 -1
  314. package/dist/types/view/fields/radio/index.stories.d.ts +1 -1
  315. package/dist/types/view/fields/radio/set-value.stories.d.ts +1 -1
  316. package/dist/types/view/fields/radio-group/index.stories.d.ts +1 -1
  317. package/dist/types/view/fields/text-box/index.stories.d.ts +1 -1
  318. package/dist/types/view/form/usecases.stories.d.ts +1 -1
  319. package/dist/types/view/header/index.d.ts +1 -1
  320. package/dist/types/view/header/index.stories.d.ts +1 -1
  321. package/dist/types/view/micro-app/app-factory/index.d.ts +3 -3
  322. package/dist/types/view/micro-app/index.d.ts +1 -1
  323. package/dist/types/view/micro-app/resources/manifest.d.ts +2 -2
  324. package/dist/types/view/micro-app/resources/script.d.ts +1 -1
  325. package/dist/types/view/micro-app/resources/style.d.ts +1 -1
  326. package/dist/types/view/micro-app/use-app-will-render.d.ts +1 -1
  327. package/dist/types/view/micro-iframe-app/app.d.ts +2 -2
  328. package/dist/types/view/micro-iframe-app/index.d.ts +1 -1
  329. package/dist/types/view/micro-iframe-app/types.d.ts +1 -1
  330. package/dist/types/view/micro-iframe-app/use-frame-loaded.d.ts +1 -1
  331. package/dist/types/view/modals/error/index.stories.d.ts +1 -1
  332. package/dist/types/view/modals/navigation-prompt/index.stories.d.ts +1 -1
  333. package/dist/types/view/modals/session-expiry/index.stories.d.ts +1 -1
  334. package/dist/types/view/modals/wait-message/index.stories.d.ts +1 -1
  335. package/dist/types/view/storybook/decorator.d.ts +1 -1
  336. package/dist/types/view/visually-hidden/index.d.ts +1 -3
  337. package/package.json +34 -15
  338. package/dist/cjs/api/users/index.endpoint.js +0 -14
  339. package/dist/cjs/communication/http-client/tests/hello.endpoint.js +0 -14
  340. package/dist/cjs/communication/http-client/tests/private.endpoint.js +0 -14
  341. package/dist/cjs/utils/storybook/main.js +0 -38
  342. package/dist/cjs/utils/storybook/middleware.js +0 -9
  343. package/dist/cjs/view/error-toast/index.stories.js +0 -128
  344. package/dist/cjs/view/fields/check-box/index.stories.js +0 -64
  345. package/dist/cjs/view/fields/check-box/set-value.stories.js +0 -83
  346. package/dist/cjs/view/fields/combo-box/index.stories.js +0 -65
  347. package/dist/cjs/view/fields/date-input/index.stories.js +0 -53
  348. package/dist/cjs/view/fields/date-input/index1.stories.js +0 -53
  349. package/dist/cjs/view/fields/date-picker/index.stories.js +0 -53
  350. package/dist/cjs/view/fields/form-item-layout/index.stories.js +0 -43
  351. package/dist/cjs/view/fields/input-mask/index.stories.js +0 -52
  352. package/dist/cjs/view/fields/large-text-box/index.stories.js +0 -47
  353. package/dist/cjs/view/fields/radio/index.stories.js +0 -60
  354. package/dist/cjs/view/fields/radio/set-value.stories.js +0 -81
  355. package/dist/cjs/view/fields/radio-group/index.stories.js +0 -85
  356. package/dist/cjs/view/fields/text-box/index.stories.js +0 -48
  357. package/dist/cjs/view/form/index.stories.js +0 -71
  358. package/dist/cjs/view/form/usecases.stories.js +0 -59
  359. package/dist/cjs/view/header/index.stories.js +0 -24
  360. package/dist/cjs/view/live-message/index.stories.js +0 -53
  361. package/dist/cjs/view/media-breakpoint/index.stories.js +0 -24
  362. package/dist/cjs/view/modals/error/index.stories.js +0 -36
  363. package/dist/cjs/view/modals/navigation-prompt/index.stories.js +0 -32
  364. package/dist/cjs/view/modals/session-expiry/index.stories.js +0 -30
  365. package/dist/cjs/view/modals/wait-message/index.stories.js +0 -47
  366. package/dist/cjs/view/session-timeout/index.stories.js +0 -28
  367. package/dist/es/api/users/index.endpoint.js +0 -14
  368. package/dist/es/communication/http-client/tests/hello.endpoint.js +0 -14
  369. package/dist/es/communication/http-client/tests/private.endpoint.js +0 -14
  370. package/dist/es/utils/storybook/main.js +0 -38
  371. package/dist/es/utils/storybook/middleware.js +0 -9
  372. package/dist/es/view/error-toast/index.stories.js +0 -108
  373. package/dist/es/view/fields/check-box/index.stories.js +0 -47
  374. package/dist/es/view/fields/check-box/set-value.stories.js +0 -65
  375. package/dist/es/view/fields/combo-box/index.stories.js +0 -48
  376. package/dist/es/view/fields/date-input/index.stories.js +0 -35
  377. package/dist/es/view/fields/date-input/index1.stories.js +0 -35
  378. package/dist/es/view/fields/date-picker/index.stories.js +0 -35
  379. package/dist/es/view/fields/form-item-layout/index.stories.js +0 -27
  380. package/dist/es/view/fields/input-mask/index.stories.js +0 -35
  381. package/dist/es/view/fields/large-text-box/index.stories.js +0 -30
  382. package/dist/es/view/fields/radio/index.stories.js +0 -43
  383. package/dist/es/view/fields/radio/set-value.stories.js +0 -63
  384. package/dist/es/view/fields/radio-group/index.stories.js +0 -68
  385. package/dist/es/view/fields/text-box/index.stories.js +0 -31
  386. package/dist/es/view/form/index.stories.js +0 -56
  387. package/dist/es/view/form/usecases.stories.js +0 -43
  388. package/dist/es/view/header/index.stories.js +0 -14
  389. package/dist/es/view/live-message/index.stories.js +0 -32
  390. package/dist/es/view/media-breakpoint/index.stories.js +0 -10
  391. package/dist/es/view/modals/error/index.stories.js +0 -21
  392. package/dist/es/view/modals/navigation-prompt/index.stories.js +0 -18
  393. package/dist/es/view/modals/session-expiry/index.stories.js +0 -18
  394. package/dist/es/view/modals/wait-message/index.stories.js +0 -33
  395. package/dist/es/view/session-timeout/index.stories.js +0 -13
  396. package/dist/types/utils/storybook/main.d.ts +0 -30
  397. package/dist/types/view/fields/date-input/index1.stories.d.ts +0 -24
@@ -1,14 +1,18 @@
1
- export const bindEvent = (element, eventName, eventHandler) => {
1
+ const bindEvent = (element, eventName, eventHandler) => {
2
2
  if (element.addEventListener) {
3
3
  element.addEventListener(eventName, eventHandler, false);
4
4
  } else if (element.attachEvent) {
5
5
  element.attachEvent(`on${eventName}`, eventHandler);
6
6
  }
7
7
  };
8
- export const removeEvent = (element, eventName, eventHandler) => {
8
+ const removeEvent = (element, eventName, eventHandler) => {
9
9
  if (element.removeEventListener) {
10
10
  element.removeEventListener(eventName, eventHandler);
11
11
  } else if (element.detachEvent) {
12
12
  element.detachEvent(`on${eventName}`, eventHandler);
13
13
  }
14
- };
14
+ };
15
+ export {
16
+ bindEvent,
17
+ removeEvent
18
+ };
@@ -1,4 +1,4 @@
1
- import { Meta } from '@storybook/addon-docs/blocks';
1
+ import { Meta } from '@storybook/addon-docs';
2
2
 
3
3
  <Meta title="Intro" />
4
4
 
@@ -1,25 +1,16 @@
1
- import _jsx from "@babel/runtime/helpers/jsx";
2
- import { LiveMessage as AriaLiveMessage } from 'react-aria-live';
1
+ import * as React from "react";
2
+ import { LiveMessage as AriaLiveMessage } from "react-aria-live";
3
3
  import { useAppSelector } from "../../data/react-redux.js";
4
- export const LiveMessage = () => {
5
- const message = useAppSelector(state => {
6
- var _state$liveMessage;
7
-
8
- return (_state$liveMessage = state.liveMessage) === null || _state$liveMessage === void 0 ? void 0 : _state$liveMessage.message;
9
- });
10
- const id = useAppSelector(state => {
11
- var _state$liveMessage2;
12
-
13
- return (_state$liveMessage2 = state.liveMessage) === null || _state$liveMessage2 === void 0 ? void 0 : _state$liveMessage2.id;
14
- });
15
- const ariaLive = useAppSelector(state => {
16
- var _state$liveMessage3;
17
-
18
- return (_state$liveMessage3 = state.liveMessage) === null || _state$liveMessage3 === void 0 ? void 0 : _state$liveMessage3.ariaLive;
19
- });
20
- return /*#__PURE__*/_jsx(AriaLiveMessage, {
21
- message: message,
4
+ const LiveMessage = () => {
5
+ const message = useAppSelector((state) => state.liveMessage?.message);
6
+ const id = useAppSelector((state) => state.liveMessage?.id);
7
+ const ariaLive = useAppSelector((state) => state.liveMessage?.ariaLive);
8
+ return /* @__PURE__ */ React.createElement(AriaLiveMessage, {
9
+ message,
22
10
  "aria-live": ariaLive,
23
- id: id
11
+ id
24
12
  });
25
- };
13
+ };
14
+ export {
15
+ LiveMessage
16
+ };
@@ -1,16 +1,14 @@
1
- import _jsx from "@babel/runtime/helpers/jsx";
2
-
3
- var _WaitMessageLauncher;
4
-
5
- import { lazy, Suspense } from 'react';
6
- import { WaitMessageLauncher } from "../modals/wait-message/wait-message-launcher.js"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
-
8
- import { jsx as _jsx2 } from "react/jsx-runtime";
9
- export const loadable = (importFunc, fallback = _WaitMessageLauncher || (_WaitMessageLauncher = /*#__PURE__*/_jsx(WaitMessageLauncher, {}))) => {
10
- const LazyComponent = /*#__PURE__*/lazy(importFunc); // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
-
12
- return props => /*#__PURE__*/_jsx(Suspense, {
13
- fallback: fallback
14
- }, void 0, /*#__PURE__*/_jsx2(LazyComponent, { ...props
1
+ import * as React from "react";
2
+ import { lazy, Suspense } from "react";
3
+ import { WaitMessageLauncher } from "../modals/wait-message/wait-message-launcher.js";
4
+ const loadable = (importFunc, fallback = /* @__PURE__ */ React.createElement(WaitMessageLauncher, null)) => {
5
+ const LazyComponent = lazy(importFunc);
6
+ return (props) => /* @__PURE__ */ React.createElement(Suspense, {
7
+ fallback
8
+ }, /* @__PURE__ */ React.createElement(LazyComponent, {
9
+ ...props
15
10
  }));
16
- };
11
+ };
12
+ export {
13
+ loadable
14
+ };
@@ -1,25 +1,22 @@
1
- import { useEffect } from 'react';
1
+ import * as React from "react";
2
+ import { useEffect } from "react";
2
3
  import { useAppDispatch } from "../../data/react-redux.js";
3
4
  import { login } from "../../utils/auth/index.js";
4
5
  import { LOGIN_SUCCESS } from "../../data/auth/actions.js";
5
- import { Fragment as _Fragment } from "react/jsx-runtime";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export const Login = ({
6
+ const Login = ({
8
7
  clientId,
9
8
  scope,
10
9
  responseType
11
10
  }) => {
12
11
  const dispatch = useAppDispatch();
13
12
  useEffect(() => {
14
- login({
15
- clientId,
16
- scope,
17
- responseType
18
- }).then(() => {
19
- dispatch({
20
- type: LOGIN_SUCCESS
21
- });
22
- }).catch(() => {});
13
+ login({ clientId, scope, responseType }).then(() => {
14
+ dispatch({ type: LOGIN_SUCCESS });
15
+ }).catch(() => {
16
+ });
23
17
  }, [dispatch, clientId, scope, responseType]);
24
- return /*#__PURE__*/_jsx(_Fragment, {});
25
- };
18
+ return /* @__PURE__ */ React.createElement(React.Fragment, null);
19
+ };
20
+ export {
21
+ Login
22
+ };
@@ -1,22 +1,25 @@
1
- import { useEffect, useContext } from 'react';
2
- import { ThemeContext } from 'styled-components';
3
- import { publish } from 'pubsub-js';
1
+ import * as React from "react";
2
+ import { useEffect, useContext } from "react";
3
+ import { ThemeContext } from "styled-components";
4
+ import { publish } from "pubsub-js";
4
5
  import { useAppDispatch } from "../../data/react-redux.js";
5
6
  import { breakpoint } from "../../data/breakpoint/index.js";
6
7
  import { useMediaBreakpoints } from "../useMediaBreakpoints/index.js";
7
8
  import { HOST_WINDOW_BREAKPOINT_CHANGED } from "../../utils/constants.js";
8
- import { Fragment as _Fragment } from "react/jsx-runtime";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- export const MediaBreakpoint = () => {
9
+ const MediaBreakpoint = () => {
11
10
  const theme = useContext(ThemeContext);
12
- const currentBreakpoint = useMediaBreakpoints([`(max-width: ${theme.breakpoints.small})`, `(max-width: ${theme.breakpoints.medium})`, `(max-width: ${theme.breakpoints.large})`], ['small', 'medium', 'large'], 'large');
11
+ const currentBreakpoint = useMediaBreakpoints([
12
+ `(max-width: ${theme.breakpoints.small})`,
13
+ `(max-width: ${theme.breakpoints.medium})`,
14
+ `(max-width: ${theme.breakpoints.large})`
15
+ ], ["small", "medium", "large"], "large");
13
16
  const dispatch = useAppDispatch();
14
17
  useEffect(() => {
15
- dispatch({
16
- type: breakpoint.change,
17
- payload: currentBreakpoint
18
- });
18
+ dispatch({ type: breakpoint.change, payload: currentBreakpoint });
19
19
  publish(HOST_WINDOW_BREAKPOINT_CHANGED, currentBreakpoint);
20
20
  }, [currentBreakpoint, dispatch]);
21
- return /*#__PURE__*/_jsx(_Fragment, {});
22
- };
21
+ return /* @__PURE__ */ React.createElement(React.Fragment, null);
22
+ };
23
+ export {
24
+ MediaBreakpoint
25
+ };
@@ -1,14 +1,15 @@
1
1
  import { removeEvent } from "../host-binding-events/index.js";
2
- export const getHostAppData = (action, resolve) => event => {
3
- if (event.data.id === 'host-app-data') {
4
- action(event.data); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5
- // @ts-ignore
6
-
7
- removeEvent(window, 'message', getHostAppData());
2
+ const getHostAppData = (action, resolve) => (event) => {
3
+ if (event.data.id === "host-app-data") {
4
+ action(event.data);
5
+ removeEvent(window, "message", getHostAppData());
8
6
  }
9
-
10
7
  resolve();
11
8
  };
12
- export const sendMessageToHost = (message, hostedAppUrl = document.referrer) => {
9
+ const sendMessageToHost = (message, hostedAppUrl = document.referrer) => {
13
10
  window.parent.postMessage(message, hostedAppUrl);
14
- };
11
+ };
12
+ export {
13
+ getHostAppData,
14
+ sendMessageToHost
15
+ };
@@ -1,19 +1,28 @@
1
- /* eslint-disable max-lines */
2
1
  import { persistentStorage } from "../../../utils/web-storage.js";
3
2
  import { CMicroAppHost } from "../../../utils/micro-frontend/host.js";
4
3
  import { getLogger } from "../../../utils/micro-frontend/index.js";
5
4
  import { logRecords } from "../../../utils/log-records.js";
6
5
  import { APP_CONTAINER_ID_PREFIX } from "../const.js";
7
- import { getCurrentBreakpoint, getViewportSize } from "../../../utils/window.js";
8
- import { addStylesToDOM, removeDynamicImportedStyles } from "../resources/style.js";
9
- import { addScriptToDOM, removeDynamicImportedScripts, removePrefetchLinks } from "../resources/script.js";
10
- import { getAppManifest, getFullFileNameofAssetsFromManifest } from "../resources/manifest.js";
6
+ import {
7
+ getCurrentBreakpoint,
8
+ getViewportSize
9
+ } from "../../../utils/window.js";
10
+ import {
11
+ addStylesToDOM,
12
+ removeDynamicImportedStyles
13
+ } from "../resources/style.js";
14
+ import {
15
+ addScriptToDOM,
16
+ removeDynamicImportedScripts,
17
+ removePrefetchLinks
18
+ } from "../resources/script.js";
19
+ import {
20
+ getAppManifest,
21
+ getFullFileNameofAssetsFromManifest
22
+ } from "../resources/manifest.js";
11
23
  const cssType = new RegExp(/\.css$/);
12
-
13
- const isCss = fileName => cssType.test(fileName);
14
-
24
+ const isCss = (fileName) => cssType.test(fileName);
15
25
  const activeApps = {};
16
-
17
26
  const initApplication = async ({
18
27
  id,
19
28
  name,
@@ -23,12 +32,10 @@ const initApplication = async ({
23
32
  manifestPath,
24
33
  homeRoute
25
34
  }) => {
26
- const app = (window.emui || {})[id] || {}; // eslint-disable-next-line @typescript-eslint/unbound-method
27
-
28
- const {
29
- init
30
- } = app;
31
- if (!init || typeof init !== 'function') throw new Error(`Application ${name} with id ${id} doesn't expose init method.`);
35
+ const app = (window.emui || {})[id] || {};
36
+ const { init } = app;
37
+ if (!init || typeof init !== "function")
38
+ throw new Error(`Application ${name} with id ${id} doesn't expose init method.`);
32
39
  const prevState = await persistentStorage.get(`state-${id}`);
33
40
  return init({
34
41
  host: CMicroAppHost.getInstance(),
@@ -42,118 +49,97 @@ const initApplication = async ({
42
49
  hostViewportSize: getViewportSize()
43
50
  });
44
51
  };
45
-
46
- export const mountApp = async ({
47
- id,
48
- name
49
- }) => {
50
- const app = (window.emui || {})[id] || {}; // eslint-disable-next-line @typescript-eslint/unbound-method
51
-
52
- const {
53
- mount
54
- } = app;
55
- if (!mount || typeof mount !== 'function') throw new Error(`Application ${name} with id ${id} doesn't expose mount method.`);
52
+ const mountApp = async ({ id, name }) => {
53
+ const app = (window.emui || {})[id] || {};
54
+ const { mount } = app;
55
+ if (!mount || typeof mount !== "function")
56
+ throw new Error(`Application ${name} with id ${id} doesn't expose mount method.`);
56
57
  return mount({
57
58
  containerId: `${APP_CONTAINER_ID_PREFIX}${id}`,
58
59
  hostBreakpoint: getCurrentBreakpoint(),
59
60
  hostViewportSize: getViewportSize()
60
61
  });
61
62
  };
62
- export const unmountApp = async ({
63
- id,
64
- name
65
- }) => {
63
+ const unmountApp = async ({ id, name }) => {
66
64
  const app = (window.emui || {})[id];
67
- if (!app) return null; // eslint-disable-next-line @typescript-eslint/unbound-method
68
-
69
- const {
70
- unmount
71
- } = app;
72
- if (!unmount) return null;
73
- if (typeof unmount !== 'function') throw new Error(`unmount failed for application ${name} with id ${id}. unmount is not a valid function`);
65
+ if (!app)
66
+ return null;
67
+ const { unmount } = app;
68
+ if (!unmount)
69
+ return null;
70
+ if (typeof unmount !== "function")
71
+ throw new Error(`unmount failed for application ${name} with id ${id}. unmount is not a valid function`);
74
72
  const currentState = await unmount({
75
73
  containerId: `${APP_CONTAINER_ID_PREFIX}${id}`
76
74
  });
77
-
78
75
  if (currentState) {
79
76
  await persistentStorage.set(`state-${id}`, currentState);
80
77
  }
81
-
82
78
  return Promise.resolve();
83
79
  };
84
-
85
80
  const addAppToActiveAppList = (id, elementIds) => {
86
- const app = (window.emui || {})[id] || {}; // eslint-disable-next-line @typescript-eslint/unbound-method
87
-
88
- const {
89
- getRef
90
- } = app;
91
- activeApps[id] = {
92
- elementIds
93
- };
81
+ const app = (window.emui || {})[id] || {};
82
+ const { getRef } = app;
83
+ activeApps[id] = { elementIds };
94
84
  const host = CMicroAppHost.getInstance();
95
- if (host) host.activeGuests[id] = getRef && getRef() || {};
85
+ if (host)
86
+ host.activeGuests[id] = getRef && getRef() || {};
96
87
  return Promise.resolve();
97
88
  };
98
-
99
- const waitAndInitApplication = (appConfig, requests) => // wait for all assets to get downloaded
100
- Promise.all(requests).then(addAppToActiveAppList.bind(null, appConfig.id)).then(initApplication.bind(null, appConfig)).catch(err => {
89
+ const waitAndInitApplication = (appConfig, requests) => Promise.all(requests).then(addAppToActiveAppList.bind(null, appConfig.id)).then(initApplication.bind(null, appConfig)).catch((err) => {
101
90
  const logRecord = logRecords.APP_INIT_FAILED(appConfig.id, err.message);
102
- getLogger().error({ ...logRecord,
103
- exception: err
104
- });
91
+ getLogger().error({ ...logRecord, exception: err });
105
92
  throw new Error(logRecord.msg);
106
93
  });
107
-
108
94
  const removeAssetsFromDOM = (id, documentEle = document) => {
109
95
  const host = CMicroAppHost.getInstance();
110
- if (host) delete host.activeGuests[id];
111
- const {
112
- elementIds
113
- } = activeApps[id] || {};
114
-
96
+ if (host)
97
+ delete host.activeGuests[id];
98
+ const { elementIds } = activeApps[id] || {};
115
99
  if (elementIds) {
116
- elementIds.forEach(elementId => {
100
+ elementIds.forEach((elementId) => {
117
101
  const ele = documentEle.getElementById(elementId);
118
- if (ele) ele.remove();
102
+ if (ele)
103
+ ele.remove();
119
104
  });
120
105
  delete activeApps[id];
121
106
  }
122
- }; // const addGoogleTagManager = (appConfig: MicroAppConfig, counter: number) : Promise<string> | null => {
123
- // const { gtmId } = appConfig;
124
- // if (!gtmId) return null;
125
- // return addScriptToDOM(appConfig, 'https://www.googletagmanager.com/gtm.js?id=')
126
- // };
127
-
128
-
129
- export const loadApp = async appConfig => {
130
- // get application manifest & full asset name with hash value
107
+ };
108
+ const loadApp = async (appConfig) => {
131
109
  getLogger().info(logRecords.APP_LOADING(appConfig.id));
132
110
  let assets = appConfig.files;
133
111
  const manifest = await getAppManifest(appConfig);
134
- assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files); // download each asset by adding it to DOM
135
-
112
+ assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files);
136
113
  let counter = 0;
137
- const requests = assets.map(fileName => {
114
+ const requests = assets.map((fileName) => {
138
115
  counter += 1;
139
116
  return !isCss(fileName) ? addScriptToDOM(appConfig, fileName, counter) : addStylesToDOM(appConfig, fileName, counter);
140
- }); // wait for all assets to get loaded in DOM and init
141
-
117
+ });
142
118
  await waitAndInitApplication(appConfig, requests);
143
119
  getLogger().info(logRecords.APP_LOADING_COMPLETE(appConfig.id));
144
120
  };
145
- export const unloadApp = ({
121
+ const unloadApp = ({
146
122
  id,
147
123
  hostUrl,
148
124
  documentEle
149
125
  }) => {
126
+ if (!hostUrl)
127
+ throw new Error("Unable to unload app. hostUrl is required");
150
128
  getLogger().info(logRecords.APP_UNLOADING(id));
151
129
  const app = (window.emui || {})[id];
152
- if (!app) return;
130
+ if (!app)
131
+ return;
153
132
  removeAssetsFromDOM(id, documentEle);
154
133
  removeDynamicImportedScripts(hostUrl, documentEle);
155
134
  removePrefetchLinks(hostUrl, documentEle);
156
135
  removeDynamicImportedStyles(hostUrl, documentEle);
157
- if (window.emui && window.emui[id]) delete window.emui[id];
136
+ if (window.emui && window.emui[id])
137
+ delete window.emui[id];
158
138
  getLogger().info(logRecords.APP_UNLOADING_COMPLETE(id));
159
- };
139
+ };
140
+ export {
141
+ loadApp,
142
+ mountApp,
143
+ unloadApp,
144
+ unmountApp
145
+ };
@@ -1 +1,4 @@
1
- export const APP_CONTAINER_ID_PREFIX = 'pui-app-container-';
1
+ const APP_CONTAINER_ID_PREFIX = "pui-app-container-";
2
+ export {
3
+ APP_CONTAINER_ID_PREFIX
4
+ };
@@ -1,15 +1,18 @@
1
- import _jsx from "@babel/runtime/helpers/jsx";
2
- import _styled from "styled-components";
3
- import { memo } from 'react';
1
+ import * as React from "react";
2
+ import { memo } from "react";
3
+ import styled from "styled-components";
4
4
  import { APP_CONTAINER_ID_PREFIX } from "./const.js";
5
5
  import { useAppWillRender } from "./use-app-will-render.js";
6
- export const MicroApp = /*#__PURE__*/memo(props => {
6
+ const Div = styled.div`
7
+ height: 100%;
8
+ width: 100%;
9
+ `;
10
+ const MicroApp = memo((props) => {
7
11
  useAppWillRender(props);
8
- return /*#__PURE__*/_jsx(_StyledDiv, {
12
+ return /* @__PURE__ */ React.createElement(Div, {
9
13
  id: `${APP_CONTAINER_ID_PREFIX}${props.id}`
10
14
  });
11
15
  });
12
-
13
- var _StyledDiv = /*#__PURE__*/_styled("div").withConfig({
14
- componentId: "sc-1bjah6z-0"
15
- })(["height:100%;width:100%;"]);
16
+ export {
17
+ MicroApp
18
+ };
@@ -2,37 +2,39 @@ import { getHTTPClient } from "../../../communication/http-client/index.js";
2
2
  import { removeDoubleSlash } from "../../../utils/url.js";
3
3
  import { getLogger } from "../../../utils/micro-frontend/index.js";
4
4
  import { logRecords } from "../../../utils/log-records.js";
5
-
6
- const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d+/, '/latest');
7
-
8
- export const getAppManifest = async ({
5
+ const getUnVersionedManifestPath = (path) => path.replace(/\/\d+\.\d+/, "/latest");
6
+ const getAppManifest = async ({
9
7
  hostUrl,
10
8
  manifestPath
11
9
  }) => {
12
- const url = new URL(`${manifestPath.replace(/\/?$/, '/')}manifest.json`, hostUrl);
10
+ if (!hostUrl || !manifestPath)
11
+ throw new Error("Unable to get app manifest. hostUrl and manifestPath are required.");
12
+ const url = new URL(`${manifestPath.replace(/\/?$/, "/")}manifest.json`, hostUrl);
13
13
  const response = await getHTTPClient().get(removeDoubleSlash(url.href));
14
- const {
15
- headers
16
- } = response;
17
- if (headers['content-type'] && headers['content-type'].includes('application/json')) return response.data;
14
+ const { headers } = response;
15
+ if (headers["content-type"] && headers["content-type"].includes("application/json"))
16
+ return response.data;
18
17
  const unVersionedManifestPath = getUnVersionedManifestPath(manifestPath);
19
-
20
18
  if (manifestPath !== unVersionedManifestPath) {
21
19
  return getAppManifest({
22
20
  hostUrl,
23
21
  manifestPath: getUnVersionedManifestPath(manifestPath)
24
22
  });
25
23
  }
26
-
27
- throw new Error('manifest.json is not available for the application');
24
+ throw new Error("manifest.json is not available for the application");
28
25
  };
29
- export const getFullFileNameofAssetsFromManifest = (manifest, assetNames = []) => assetNames.reduce((assets, assetName) => {
26
+ const getFullFileNameofAssetsFromManifest = (manifest, assetNames = []) => assetNames.reduce((assets, assetName) => {
30
27
  const fullFileName = manifest[assetName];
31
- if (fullFileName) assets.push(fullFileName); // eslint-disable-next-line no-console
28
+ if (fullFileName)
29
+ assets.push(fullFileName);
32
30
  else {
33
31
  const logRecord = logRecords.ASSET_NOT_FOUND_IN_MANIFEST(assetName);
34
32
  getLogger().error(logRecord);
35
33
  throw new Error(logRecord.msg);
36
34
  }
37
35
  return assets;
38
- }, []);
36
+ }, []);
37
+ export {
38
+ getAppManifest,
39
+ getFullFileNameofAssetsFromManifest
40
+ };
@@ -1,53 +1,53 @@
1
1
  import { removeDoubleSlash } from "../../../utils/url.js";
2
- export const APP_SCRIPT_ID_PREFIX = 'emui-script-';
3
- const HEAD_SCRIPTS = new RegExp('/(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js', 'i'); // const isDeferEligible = (scriptSrc: string) => !HEAD_SCRIPTS.test(scriptSrc);
4
-
5
- const isHeadScript = scriptSrc => HEAD_SCRIPTS.test(scriptSrc);
6
-
7
- export const addScriptToDOM = ({
8
- name,
9
- hostUrl,
10
- documentEle
11
- }, fileName, index) => new Promise((resolve, reject) => {
12
- const ele = documentEle.createElement('script');
13
- if (!ele) reject(new Error('Unable to insert Application scripts.'));
2
+ const APP_SCRIPT_ID_PREFIX = "emui-script-";
3
+ const HEAD_SCRIPTS = new RegExp("/(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js", "i");
4
+ const isHeadScript = (scriptSrc) => HEAD_SCRIPTS.test(scriptSrc);
5
+ const addScriptToDOM = ({ name, hostUrl, documentEle }, fileName, index) => new Promise((resolve, reject) => {
6
+ const ele = documentEle.createElement("script");
7
+ if (!ele)
8
+ reject(new Error("Unable to insert Application scripts."));
14
9
  ele.id = `${APP_SCRIPT_ID_PREFIX}${name}-${index}`;
15
10
  const url = new URL(fileName, hostUrl);
16
11
  ele.src = removeDoubleSlash(url.href);
17
12
  ele.onload = resolve.bind(null, ele.id);
18
13
  ele.onerror = reject.bind(null, ele.id);
19
- ele.async = false; // execute the scripts in the same order as they are inserted
20
-
21
- if (isHeadScript(ele.src)) documentEle.head.appendChild(ele);else documentEle.body.appendChild(ele);
14
+ ele.async = false;
15
+ if (isHeadScript(ele.src))
16
+ documentEle.head.appendChild(ele);
17
+ else
18
+ documentEle.body.appendChild(ele);
22
19
  });
23
- export const removeScriptFromDOM = (elementId = '', documentEle = document) => new Promise(resolve => {
24
- const ele = documentEle.getElementById(elementId); // eslint-disable-next-line no-console
25
-
26
- if (!ele) console.warn(new Error(`script with id ${elementId} not found`));
20
+ const removeScriptFromDOM = (elementId = "", documentEle = document) => new Promise((resolve) => {
21
+ const ele = documentEle.getElementById(elementId);
22
+ if (!ele)
23
+ console.warn(new Error(`script with id ${elementId} not found`));
27
24
  ele.remove();
28
25
  resolve();
29
26
  });
30
- export const removeDynamicImportedScripts = (hostUrl, documentEle) => {
31
- const hostPattern = new RegExp(hostUrl, 'i');
32
- const scriptElements = documentEle.getElementsByTagName('script');
33
-
27
+ const removeDynamicImportedScripts = (hostUrl, documentEle) => {
28
+ const hostPattern = new RegExp(hostUrl, "i");
29
+ const scriptElements = documentEle.getElementsByTagName("script");
34
30
  for (let index = scriptElements.length - 1; index >= 0; index -= 1) {
35
31
  const scriptEle = scriptElements[index];
36
- const {
37
- src
38
- } = scriptEle;
39
- if (hostPattern.test(src)) scriptEle.remove();
32
+ const { src } = scriptEle;
33
+ if (hostPattern.test(src))
34
+ scriptEle.remove();
40
35
  }
41
36
  };
42
- export const removePrefetchLinks = (hostUrl, documentEle) => {
43
- const hostPattern = new RegExp(hostUrl, 'i');
37
+ const removePrefetchLinks = (hostUrl, documentEle) => {
38
+ const hostPattern = new RegExp(hostUrl, "i");
44
39
  const prefetchElements = documentEle.querySelectorAll('[rel="prefetch"]');
45
-
46
40
  for (let index = prefetchElements.length - 1; index >= 0; index -= 1) {
47
41
  const ele = prefetchElements[index];
48
- const {
49
- href
50
- } = ele;
51
- if (hostPattern.test(href)) ele.remove();
42
+ const { href } = ele;
43
+ if (hostPattern.test(href))
44
+ ele.remove();
52
45
  }
53
- };
46
+ };
47
+ export {
48
+ APP_SCRIPT_ID_PREFIX,
49
+ addScriptToDOM,
50
+ removeDynamicImportedScripts,
51
+ removePrefetchLinks,
52
+ removeScriptFromDOM
53
+ };