@linzjs/lui 17.16.1 → 17.16.2-1

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 (174) hide show
  1. package/dist/animations/loader-easter.json +2790 -0
  2. package/dist/animations/loader-xmas.json +3813 -0
  3. package/dist/animations/loader.json +1494 -0
  4. package/dist/assets/svg-content.js +323 -0
  5. package/dist/assets/svg-content.js.map +1 -0
  6. package/dist/components/LuiAccordicard/LuiAccordicard.js +55 -0
  7. package/dist/components/LuiAccordicard/LuiAccordicard.js.map +1 -0
  8. package/dist/components/LuiAccordicardStatic/LuiAccordicardStatic.js +17 -0
  9. package/dist/components/LuiAccordicardStatic/LuiAccordicardStatic.js.map +1 -0
  10. package/dist/components/LuiBadge/LuiBadge.d.ts +1 -1
  11. package/dist/components/LuiBadge/LuiBadge.js +4 -0
  12. package/dist/components/LuiBadge/LuiBadge.js.map +1 -0
  13. package/dist/components/LuiBanner/LuiBanner.js +26 -0
  14. package/dist/components/LuiBanner/LuiBanner.js.map +1 -0
  15. package/dist/components/LuiButton/LuiButton.js +38 -0
  16. package/dist/components/LuiButton/LuiButton.js.map +1 -0
  17. package/dist/components/LuiError/LuiError.js +10 -0
  18. package/dist/components/LuiError/LuiError.js.map +1 -0
  19. package/dist/components/LuiErrorPage/LuiErrorPage.js +13 -0
  20. package/dist/components/LuiErrorPage/LuiErrorPage.js.map +1 -0
  21. package/dist/components/LuiExpandableBanner/LuiExpandableBanner.js +54 -0
  22. package/dist/components/LuiExpandableBanner/LuiExpandableBanner.js.map +1 -0
  23. package/dist/components/LuiFilterContainer/LuiFilterContainer.js +20 -0
  24. package/dist/components/LuiFilterContainer/LuiFilterContainer.js.map +1 -0
  25. package/dist/components/LuiFilterMenu/LuiFilterMenu.js +50 -0
  26. package/dist/components/LuiFilterMenu/LuiFilterMenu.js.map +1 -0
  27. package/dist/components/LuiFooter/LuiFooter.js +37 -0
  28. package/dist/components/LuiFooter/LuiFooter.js.map +1 -0
  29. package/dist/components/LuiFormElements/ClearableLuiTextInput/ClearableLuiTextInput.js +21 -0
  30. package/dist/components/LuiFormElements/ClearableLuiTextInput/ClearableLuiTextInput.js.map +1 -0
  31. package/dist/components/LuiFormElements/LuiCheckboxInput/LuiCheckboxInput.js +23 -0
  32. package/dist/components/LuiFormElements/LuiCheckboxInput/LuiCheckboxInput.js.map +1 -0
  33. package/dist/components/LuiFormElements/LuiFileInputBox/LuiFileInputBox.js +90 -0
  34. package/dist/components/LuiFormElements/LuiFileInputBox/LuiFileInputBox.js.map +1 -0
  35. package/dist/components/LuiFormElements/LuiRadioInput/LuiRadioInput.js +41 -0
  36. package/dist/components/LuiFormElements/LuiRadioInput/LuiRadioInput.js.map +1 -0
  37. package/dist/components/LuiFormElements/LuiSelectInput/LuiSelectInput.js +22 -0
  38. package/dist/components/LuiFormElements/LuiSelectInput/LuiSelectInput.js.map +1 -0
  39. package/dist/components/LuiFormElements/LuiTextAreaInput/LuiTextAreaInput.js +20 -0
  40. package/dist/components/LuiFormElements/LuiTextAreaInput/LuiTextAreaInput.js.map +1 -0
  41. package/dist/components/LuiFormElements/LuiTextInput/LuiTextInput.js +29 -0
  42. package/dist/components/LuiFormElements/LuiTextInput/LuiTextInput.js.map +1 -0
  43. package/dist/components/LuiForms/LuiComboSelect/LuiComboSelect.js +54 -0
  44. package/dist/components/LuiForms/LuiComboSelect/LuiComboSelect.js.map +1 -0
  45. package/dist/components/LuiForms/LuiFormSection/LuiFormSectionHeader.js +9 -0
  46. package/dist/components/LuiForms/LuiFormSection/LuiFormSectionHeader.js.map +1 -0
  47. package/dist/components/LuiForms/LuiFormSection/LuiHelpInfo/LuiHelpInfo.js +7 -0
  48. package/dist/components/LuiForms/LuiFormSection/LuiHelpInfo/LuiHelpInfo.js.map +1 -0
  49. package/dist/components/LuiHeader/LuiHeader.js +79 -0
  50. package/dist/components/LuiHeader/LuiHeader.js.map +1 -0
  51. package/dist/components/LuiHeaderMenu/LuiHeaderMenus.js +73 -0
  52. package/dist/components/LuiHeaderMenu/LuiHeaderMenus.js.map +1 -0
  53. package/dist/components/LuiIcon/LuiIcon.js +39 -0
  54. package/dist/components/LuiIcon/LuiIcon.js.map +1 -0
  55. package/dist/components/LuiListBox/LuiListBox.js +60 -0
  56. package/dist/components/LuiListBox/LuiListBox.js.map +1 -0
  57. package/dist/components/LuiListBox/LuiListBoxGroup.js +15 -0
  58. package/dist/components/LuiListBox/LuiListBoxGroup.js.map +1 -0
  59. package/dist/components/LuiListBox/LuiListBoxItem.js +20 -0
  60. package/dist/components/LuiListBox/LuiListBoxItem.js.map +1 -0
  61. package/dist/components/LuiListBox/Renderers/CheckboxItemRenderer.js +10 -0
  62. package/dist/components/LuiListBox/Renderers/CheckboxItemRenderer.js.map +1 -0
  63. package/dist/components/LuiListBox/Renderers/RadioItemRenderer.js +7 -0
  64. package/dist/components/LuiListBox/Renderers/RadioItemRenderer.js.map +1 -0
  65. package/dist/components/LuiListBox/useLuiListBox.js +60 -0
  66. package/dist/components/LuiListBox/useLuiListBox.js.map +1 -0
  67. package/dist/components/LuiLoadingSpinner/LuiLoadingSpinner.js +62 -0
  68. package/dist/components/LuiLoadingSpinner/LuiLoadingSpinner.js.map +1 -0
  69. package/dist/components/LuiLoadingSpinner/LuiLottieLight.js +28 -0
  70. package/dist/components/LuiLoadingSpinner/LuiLottieLight.js.map +1 -0
  71. package/dist/components/LuiMenu/LuiMenu.js +18 -0
  72. package/dist/components/LuiMenu/LuiMenu.js.map +1 -0
  73. package/dist/components/LuiMenuTrigger/LuiMenuTrigger.js +10 -0
  74. package/dist/components/LuiMenuTrigger/LuiMenuTrigger.js.map +1 -0
  75. package/dist/components/LuiModal/LuiModal.js +57 -0
  76. package/dist/components/LuiModal/LuiModal.js.map +1 -0
  77. package/dist/components/LuiModal/LuiModalContext.js +30 -0
  78. package/dist/components/LuiModal/LuiModalContext.js.map +1 -0
  79. package/dist/components/LuiSearchBox/LuiSearchBox.js +67 -0
  80. package/dist/components/LuiSearchBox/LuiSearchBox.js.map +1 -0
  81. package/dist/components/LuiSearchInput/LuiSearchInput.js +184 -0
  82. package/dist/components/LuiSearchInput/LuiSearchInput.js.map +1 -0
  83. package/dist/components/LuiSearchInput/ResultsDisplay.js +38 -0
  84. package/dist/components/LuiSearchInput/ResultsDisplay.js.map +1 -0
  85. package/dist/components/LuiSelectMenu/LuiSelectDataMenu.js +34 -0
  86. package/dist/components/LuiSelectMenu/LuiSelectDataMenu.js.map +1 -0
  87. package/dist/components/LuiSelectMenu/LuiSelectMenu.js +29 -0
  88. package/dist/components/LuiSelectMenu/LuiSelectMenu.js.map +1 -0
  89. package/dist/components/LuiShadow/LuiShadow.js +6 -0
  90. package/dist/components/LuiShadow/LuiShadow.js.map +1 -0
  91. package/dist/components/LuiSidePanel/LuiSidePanel.js +51 -0
  92. package/dist/components/LuiSidePanel/LuiSidePanel.js.map +1 -0
  93. package/dist/components/LuiSidePanel/LuiSidePanelHelper.js +31 -0
  94. package/dist/components/LuiSidePanel/LuiSidePanelHelper.js.map +1 -0
  95. package/dist/components/LuiStaticMessage/LuiStaticMessage.js +17 -0
  96. package/dist/components/LuiStaticMessage/LuiStaticMessage.js.map +1 -0
  97. package/dist/components/LuiSwitchButton/LuiSwitchButton.js +12 -0
  98. package/dist/components/LuiSwitchButton/LuiSwitchButton.js.map +1 -0
  99. package/dist/components/LuiTabs/LuiTab/LuiTab.js +6 -0
  100. package/dist/components/LuiTabs/LuiTab/LuiTab.js.map +1 -0
  101. package/dist/components/LuiTabs/LuiTabs.js +11 -0
  102. package/dist/components/LuiTabs/LuiTabs.js.map +1 -0
  103. package/dist/components/LuiTabs/LuiTabsGroup/LuiTabsGroup.js +6 -0
  104. package/dist/components/LuiTabs/LuiTabsGroup/LuiTabsGroup.js.map +1 -0
  105. package/dist/components/LuiTabs/LuiTabsPanel/LuiTabsPanel.js +16 -0
  106. package/dist/components/LuiTabs/LuiTabsPanel/LuiTabsPanel.js.map +1 -0
  107. package/dist/components/LuiTabs/LuiTabsPanelSwitch/LuiTabsPanelSwitch.js +12 -0
  108. package/dist/components/LuiTabs/LuiTabsPanelSwitch/LuiTabsPanelSwitch.js.map +1 -0
  109. package/dist/components/LuiToastMessage/LuiToastMessage.js +47 -0
  110. package/dist/components/LuiToastMessage/LuiToastMessage.js.map +1 -0
  111. package/dist/components/LuiTooltip/LuiTooltip.js +32 -0
  112. package/dist/components/LuiTooltip/LuiTooltip.js.map +1 -0
  113. package/dist/components/LuiUpdateSplashModal/LuiUpdatesSplashModal.d.ts +1 -1
  114. package/dist/components/LuiUpdateSplashModal/LuiUpdatesSplashModal.js +41 -0
  115. package/dist/components/LuiUpdateSplashModal/LuiUpdatesSplashModal.js.map +1 -0
  116. package/dist/components/common/Hooks.js +51 -0
  117. package/dist/components/common/Hooks.js.map +1 -0
  118. package/dist/components/common/ResponsiveUtils.js +16 -0
  119. package/dist/components/common/ResponsiveUtils.js.map +1 -0
  120. package/dist/components/common/StorybookSupport.js +14 -0
  121. package/dist/components/common/StorybookSupport.js.map +1 -0
  122. package/dist/components/lol/LOLActiveFirmMessage.js +30 -0
  123. package/dist/components/lol/LOLActiveFirmMessage.js.map +1 -0
  124. package/dist/components/lol/LOLAppLauncherMenu.js +86 -0
  125. package/dist/components/lol/LOLAppLauncherMenu.js.map +1 -0
  126. package/dist/components/lol/LOLAuthorisedLink.js +35 -0
  127. package/dist/components/lol/LOLAuthorisedLink.js.map +1 -0
  128. package/dist/components/lol/LOLCommonDrawerMenu.js +58 -0
  129. package/dist/components/lol/LOLCommonDrawerMenu.js.map +1 -0
  130. package/dist/components/lol/LOLDrawerMenuFirmSwitcher.js +21 -0
  131. package/dist/components/lol/LOLDrawerMenuFirmSwitcher.js.map +1 -0
  132. package/dist/components/lol/LOLFirmSwitcher.js +84 -0
  133. package/dist/components/lol/LOLFirmSwitcher.js.map +1 -0
  134. package/dist/components/lol/LOLLogoutLink.js +46 -0
  135. package/dist/components/lol/LOLLogoutLink.js.map +1 -0
  136. package/dist/components/lol/LOLSearchBox.js +105 -0
  137. package/dist/components/lol/LOLSearchBox.js.map +1 -0
  138. package/dist/components/lol/LOLUserLastLogin.js +25 -0
  139. package/dist/components/lol/LOLUserLastLogin.js.map +1 -0
  140. package/dist/components/lol/MockBackendUtils.js +30 -0
  141. package/dist/components/lol/MockBackendUtils.js.map +1 -0
  142. package/dist/components/lol/contexts/LOLGlobalClientRefContext.js +75 -0
  143. package/dist/components/lol/contexts/LOLGlobalClientRefContext.js.map +1 -0
  144. package/dist/components/lol/contexts/LOLUserContext.js +160 -0
  145. package/dist/components/lol/contexts/LOLUserContext.js.map +1 -0
  146. package/dist/components/lol/contexts/LOLUserContextSupport.js +11 -0
  147. package/dist/components/lol/contexts/LOLUserContextSupport.js.map +1 -0
  148. package/dist/components/lol/handlers.js +54 -0
  149. package/dist/components/lol/handlers.js.map +1 -0
  150. package/dist/contexts/LuiMessagingContextProvider.js +38 -0
  151. package/dist/contexts/LuiMessagingContextProvider.js.map +1 -0
  152. package/dist/fonts.js +11 -0
  153. package/dist/fonts.js.map +1 -0
  154. package/dist/hooks/index.js +2 -0
  155. package/dist/hooks/index.js.map +1 -0
  156. package/dist/hooks/useClickedOutsideElement.js +29 -0
  157. package/dist/hooks/useClickedOutsideElement.js.map +1 -0
  158. package/dist/hooks/useDeprecatedWarning.js +9 -0
  159. package/dist/hooks/useDeprecatedWarning.js.map +1 -0
  160. package/dist/index.d.ts +0 -9
  161. package/dist/index.js +5326 -4679
  162. package/dist/index.js.map +1 -1
  163. package/dist/lui.esm.js +5329 -4672
  164. package/dist/lui.esm.js.map +1 -1
  165. package/package.json +18 -19
  166. package/dist/components/LuiBearingInput/LuiBearingInput.d.ts +0 -23
  167. package/dist/components/LuiFormikForms/LuiFormikCheckbox/LuiFormikCheckbox.d.ts +0 -9
  168. package/dist/components/LuiFormikForms/LuiFormikForm.d.ts +0 -10
  169. package/dist/components/LuiFormikForms/LuiFormikFormLabel/LuiFormikFormLabel.d.ts +0 -8
  170. package/dist/components/LuiFormikForms/LuiFormikFormSubmitButton/LuiFormikFormSubmitButton.d.ts +0 -6
  171. package/dist/components/LuiFormikForms/LuiFormikRadioButton/LuiFormikRadioButton.d.ts +0 -8
  172. package/dist/components/LuiFormikForms/LuiFormikRadioGroup/LuiFormikRadioGroup.d.ts +0 -7
  173. package/dist/components/LuiFormikForms/LuiFormikSelect/LuiFormikSelect.d.ts +0 -11
  174. package/dist/components/LuiFormikForms/LuiFormikTextInput/LuiFormikTextInput.d.ts +0 -17
@@ -0,0 +1,160 @@
1
+ import { __awaiter, __generator } from "tslib";
2
+ import React, { useCallback, useContext, useEffect, useState } from 'react';
3
+ import { LuiLoadingSpinner } from '../../LuiLoadingSpinner/LuiLoadingSpinner';
4
+ import { useQuery } from 'react-query';
5
+ import { userHasAnyPrivilege, userIsInternal } from './LOLUserContextSupport';
6
+ import { useDeprecatedWarning } from '../../../hooks/useDeprecatedWarning';
7
+ function useLOLUserContext() {
8
+ return useContext(LOLUserContext);
9
+ }
10
+ var LOLUserContext = React.createContext({
11
+ user: undefined,
12
+ selectedFirm: undefined,
13
+ changeFirm: function (firmId) {
14
+ console.error('Called changeFirm before UserContext loaded', firmId);
15
+ },
16
+ isInternal: function () { return false; },
17
+ hasAnyPrivilege: function () { return false; }
18
+ });
19
+ /**
20
+ * Deprecated: this is Landonline specific and has been moved to https://github.com/linz/landonline-common-js
21
+ */
22
+ function LOLUserContextProvider(props) {
23
+ useDeprecatedWarning('LOLUserContextProvider');
24
+ var _a = useGetUserInfo(), isLoading = _a.isLoading, data = _a.data, isError = _a.isError;
25
+ var _b = useState(), selectedFirm = _b[0], setSelectedFirm = _b[1];
26
+ var _c = useState(false), ready = _c[0], setReady = _c[1];
27
+ useEffect(function () {
28
+ // User data is still loading
29
+ if (!(data === null || data === void 0 ? void 0 : data.user)) {
30
+ return;
31
+ }
32
+ // Clear firm value if there are no firms
33
+ if (data.user.firms.length === 0) {
34
+ setSelectedFirmCache(null, null);
35
+ setReady(true);
36
+ return;
37
+ }
38
+ if (data.user.firms.length > 0 &&
39
+ (!getSelectedFirmIdCache() ||
40
+ !data.user.firms.find(function (firm) { return firm.id === getSelectedFirmIdCache(); }))) {
41
+ var firstFirm = data.user.firms[0];
42
+ setSelectedFirmCache(firstFirm.id, firstFirm.name);
43
+ setSelectedFirm(firstFirm);
44
+ setReady(true);
45
+ }
46
+ else {
47
+ // pull firm from cache and use it
48
+ var selectedFirmIdFromCache_1 = getSelectedFirmIdCache();
49
+ var selectedFirmDerivedFromCache = data.user.firms.find(function (firm) { return firm.id === selectedFirmIdFromCache_1; });
50
+ setSelectedFirm(selectedFirmDerivedFromCache || undefined);
51
+ setReady(true);
52
+ }
53
+ }, [data]);
54
+ var changeFirm = useCallback(function (firmId) {
55
+ var _a;
56
+ var firm = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.firms.find(function (f) {
57
+ return f.id === firmId;
58
+ });
59
+ if (firm === undefined) {
60
+ // tslint:disable-next-line: no-console
61
+ console.error('Looks like firm not in userContext');
62
+ return;
63
+ }
64
+ setSelectedFirmCache(firm.id, firm.name);
65
+ setSelectedFirm(firm);
66
+ }, [data]);
67
+ var isInternal = useCallback(function () { return userIsInternal(data === null || data === void 0 ? void 0 : data.user); }, [data]);
68
+ var hasAnyPrivilege = useCallback(function (privileges) {
69
+ return userHasAnyPrivilege(privileges, selectedFirm);
70
+ }, [selectedFirm]);
71
+ useEffect(function () {
72
+ var onCachedFirmUpdate = function (event) {
73
+ if (event.storageArea === localStorage && event.key === FIRM_KEY) {
74
+ var selectedFirmId = event.newValue;
75
+ if (selectedFirmId) {
76
+ changeFirm(selectedFirmId);
77
+ }
78
+ }
79
+ };
80
+ if (ready) {
81
+ // this only triggers if changed from another tab
82
+ window.addEventListener('storage', onCachedFirmUpdate, false);
83
+ }
84
+ // cleanup listener on unmount
85
+ return function () {
86
+ window.removeEventListener('storage', onCachedFirmUpdate, false);
87
+ };
88
+ }, [ready, changeFirm]);
89
+ if (isLoading || !ready) {
90
+ return React.createElement(LuiLoadingSpinner, { "data-testid": "usercontext-loading-spinner" });
91
+ }
92
+ if (isError) {
93
+ reAuthUser();
94
+ return React.createElement(LuiLoadingSpinner, { "data-testid": "usercontext-error-spinner" });
95
+ }
96
+ if (data && data.user && data.user.id) {
97
+ return (React.createElement(LOLUserContext.Provider, { value: {
98
+ user: data.user,
99
+ selectedFirm: selectedFirm,
100
+ changeFirm: changeFirm,
101
+ isInternal: isInternal,
102
+ hasAnyPrivilege: hasAnyPrivilege
103
+ } }, props.children));
104
+ }
105
+ else {
106
+ reAuthUser();
107
+ return React.createElement(LuiLoadingSpinner, { "data-testid": "usercontext-spinner" });
108
+ }
109
+ }
110
+ function useGetUserInfo() {
111
+ var _this = this;
112
+ return useQuery("useGetUserInfo", function () { return __awaiter(_this, void 0, void 0, function () {
113
+ var url, res;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ url = "/auth/api/userinfo";
118
+ return [4 /*yield*/, fetch(url)];
119
+ case 1:
120
+ res = _a.sent();
121
+ return [4 /*yield*/, checkForStandardErrors(res)];
122
+ case 2:
123
+ _a.sent();
124
+ return [4 /*yield*/, res.json()];
125
+ case 3: return [2 /*return*/, _a.sent()];
126
+ }
127
+ });
128
+ }); });
129
+ }
130
+ function reAuthUser() {
131
+ var redirectPath = "".concat(window.location.pathname).concat(window.location.search).concat(window.location.hash);
132
+ window.location.assign("/auth/login?redirectPath=".concat(encodeURIComponent(redirectPath)));
133
+ }
134
+ function checkForStandardErrors(res) {
135
+ return __awaiter(this, void 0, void 0, function () {
136
+ return __generator(this, function (_a) {
137
+ if (res.status !== 200) {
138
+ reAuthUser();
139
+ }
140
+ return [2 /*return*/];
141
+ });
142
+ });
143
+ }
144
+ var FIRM_KEY = 'firmId';
145
+ var FIRM_NAME_KEY = 'firmName';
146
+ function getSelectedFirmIdCache() {
147
+ return window.localStorage.getItem(FIRM_KEY);
148
+ }
149
+ function setSelectedFirmCache(firmId, firmName) {
150
+ if (firmId == null || firmName == null) {
151
+ window.localStorage.removeItem(FIRM_KEY);
152
+ window.localStorage.removeItem(FIRM_NAME_KEY);
153
+ }
154
+ else {
155
+ window.localStorage.setItem(FIRM_KEY, firmId);
156
+ window.localStorage.setItem(FIRM_NAME_KEY, firmName);
157
+ }
158
+ }
159
+ export { LOLUserContext, useLOLUserContext, LOLUserContextProvider, FIRM_KEY, FIRM_NAME_KEY, };
160
+ //# sourceMappingURL=LOLUserContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LOLUserContext.js","sourceRoot":"","sources":["../../../../src/components/lol/contexts/LOLUserContext.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAU3E,SAAS,iBAAiB;IACxB,OAAO,UAAU,CAAC,cAAc,CAAC,CAAC;AACpC,CAAC;AAED,IAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAe;IACvD,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,UAAC,MAAc;QACzB,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IACD,UAAU,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;IACvB,eAAe,EAAE,cAAM,OAAA,KAAK,EAAL,CAAK;CAC7B,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,sBAAsB,CAAC,KAAoC;IAClE,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;IACzC,IAAA,KAA+B,cAAc,EA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
+ return (privileges.length === 0 ||
3
+ (selectedFirm !== undefined &&
4
+ selectedFirm.privileges.filter(function (value) { return privileges.indexOf(value) > -1; })
5
+ .length > 0));
6
+ };
7
+ export var userIsInternal = function (user) {
8
+ var loginType = (user === null || user === void 0 ? void 0 : user.loginType).code || (user === null || user === void 0 ? void 0 : user.loginType);
9
+ return loginType === 'INTN';
10
+ };
11
+ //# sourceMappingURL=LOLUserContextSupport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LOLUserContextSupport.js","sourceRoot":"","sources":["../../../../src/components/lol/contexts/LOLUserContextSupport.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,mBAAmB,GAAG,UACjC,UAAoB,EACpB,YAA+B;IAE/B,OAAO,CACL,UAAU,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,YAAY,KAAK,SAAS;YACzB,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAA9B,CAA8B,CAAC;iBACtE,MAAM,GAAG,CAAC,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,IAA8B;IAC3D,IAAM,SAAS,GACZ,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAiB,CAAA,CAAC,IAAe,KAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAoB,CAAA,CAAC;IAC3E,OAAO,SAAS,KAAK,MAAM,CAAC;AAC9B,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { rest } from 'msw';
2
+ var IS_AUTHENTICATED_KEY = 'is-authenticated';
3
+ export var handlers = [
4
+ rest.post('/auth/api/login', function (_, res, ctx) {
5
+ // Persist user's authentication in the session
6
+ sessionStorage.setItem(IS_AUTHENTICATED_KEY, 'true');
7
+ return res(
8
+ // Respond with a 200 status code
9
+ ctx.status(200));
10
+ }),
11
+ rest.get('/auth/api/logout', function (_, res, ctx) {
12
+ sessionStorage.removeItem(IS_AUTHENTICATED_KEY);
13
+ return res(ctx.status(200));
14
+ }),
15
+ rest.get('/auth/api/userinfo', function (_, res, ctx) {
16
+ // Check if the user is authenticated in this session
17
+ var isAuthenticated = sessionStorage.getItem(IS_AUTHENTICATED_KEY) === 'true';
18
+ if (!isAuthenticated) {
19
+ // If not authenticated, respond with a 403 error
20
+ return res(ctx.status(403), ctx.json({
21
+ errorMessage: 'Not authorized'
22
+ }));
23
+ }
24
+ // If authenticated, return a mocked user details
25
+ return res(ctx.status(200), ctx.json({
26
+ user: {
27
+ id: 'testRegisteredUser',
28
+ idHash: '1_testRegisteredUser_2',
29
+ email: 'bryan_dennise@test.linz.govt.nz',
30
+ givenNames: 'Bryan',
31
+ surname: 'Dennis',
32
+ loginType: 'EXTERNAL',
33
+ preferredName: 'Bry',
34
+ firms: [
35
+ {
36
+ name: 'Phil Inc',
37
+ id: 'pa-inc'
38
+ },
39
+ {
40
+ name: 'Cheese Inc',
41
+ id: 'cheese-inc'
42
+ },
43
+ {
44
+ name: 'Apple Inc',
45
+ id: 'apple-inc'
46
+ },
47
+ ],
48
+ passwordChangeRequired: false,
49
+ roles: []
50
+ }
51
+ }));
52
+ }),
53
+ ];
54
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../src/components/lol/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,IAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,MAAM,CAAC,IAAM,QAAQ,GAAG;IACtB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAC,CAAC,EAAE,GAAG,EAAE,GAAG;QACvC,+CAA+C;QAC/C,cAAc,CAAC,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;QAErD,OAAO,GAAG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EAAE,EAAE;aACV;SACF,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;CACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ import React, { createContext, useContext, useState } from 'react';
2
+ import { LuiToastMessage } from '../components/LuiToastMessage/LuiToastMessage';
3
+ var UIMessagingContext = createContext({
4
+ // @ts-ignore
5
+ showMessage: function (props) { }
6
+ });
7
+ export function useShowLUIMessage() {
8
+ return useContext(UIMessagingContext).showMessage;
9
+ }
10
+ export var LuiMessagingContextProvider = function (props) {
11
+ var _a = useState(), _message = _a[0], setMessage = _a[1];
12
+ var _b = useState(), _messageType = _b[0], setMessageType = _b[1];
13
+ var _c = useState('success'), _messageLevel = _c[0], setMessageLevel = _c[1];
14
+ var _d = useState(true), _requireDismiss = _d[0], setRequireDismiss = _d[1];
15
+ var showMessage = function (props) {
16
+ setMessage(props.message);
17
+ setMessageType(props.messageType);
18
+ setMessageLevel(props.messageLevel);
19
+ setRequireDismiss(props.requireDismiss === undefined
20
+ ? props.messageLevel === 'error'
21
+ : props.requireDismiss);
22
+ };
23
+ var renderMessage = function () {
24
+ switch (_messageType) {
25
+ case 'toast':
26
+ return (React.createElement(LuiToastMessage, { onClose: function () {
27
+ setMessage(undefined);
28
+ }, level: _messageLevel, requireDismiss: _requireDismiss },
29
+ React.createElement("span", { "data-testid": 'toastMessageShow' }, typeof _message === 'string' ? React.createElement("h2", null, _message) : _message)));
30
+ default:
31
+ return null;
32
+ }
33
+ };
34
+ return (React.createElement(UIMessagingContext.Provider, { value: { showMessage: showMessage } },
35
+ _message && renderMessage(),
36
+ props.children));
37
+ };
38
+ //# sourceMappingURL=LuiMessagingContextProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LuiMessagingContextProvider.js","sourceRoot":"","sources":["../../src/contexts/LuiMessagingContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnE,OA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AO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,gCAAK,QAAQ,CAAM,CAAC,CAAC,CAAC,QAAQ,CACzD,CACS,CACnB,CAAC;YACJ;gBACE,OAAO,IAAI,CAAC;SACf;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,aAAA,EAAE;QAChD,QAAQ,IAAI,aAAa,EAAE;QAC3B,KAAK,CAAC,QAAQ,CACa,CAC/B,CAAC;AACJ,CAAC,CAAC"}
package/dist/fonts.js ADDED
@@ -0,0 +1,11 @@
1
+ import '@fontsource/open-sans/300.css';
2
+ import '@fontsource/open-sans/400.css';
3
+ import '@fontsource/open-sans/500.css';
4
+ import '@fontsource/open-sans/600.css';
5
+ import '@fontsource/open-sans/700.css';
6
+ import '@fontsource/open-sans/300-italic.css';
7
+ import '@fontsource/open-sans/400-italic.css';
8
+ import '@fontsource/open-sans/500-italic.css';
9
+ import '@fontsource/open-sans/600-italic.css';
10
+ import '@fontsource/open-sans/700-italic.css';
11
+ //# sourceMappingURL=fonts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../src/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,+BAA+B,CAAC;AACvC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,sCAAsC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { useClickedOutsideElement } from './useClickedOutsideElement';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ /**
3
+ * This hook will callback with handleClickOutside() when "mousedown" dom event occurs off the refElement
4
+ * usage:
5
+ ```typescript
6
+ const refElement = React.useRef<HTMLButtonElement>(null);
7
+ const handleClickOutside = () => {
8
+ console.log("hello world");
9
+ };
10
+ useClickedOutsideElement(refElement, handleClickOutside);
11
+ return <button ref={refElement}>Click Me!</button>;
12
+ ```
13
+ */
14
+ export function useClickedOutsideElement(refElement, handleClickOutside) {
15
+ React.useEffect(function () {
16
+ function onOutsideClicked(event) {
17
+ var element = refElement.current;
18
+ if (!(element === null || element === void 0 ? void 0 : element.contains(event.target))) {
19
+ handleClickOutside();
20
+ }
21
+ }
22
+ document.addEventListener('mousedown', onOutsideClicked);
23
+ return function () {
24
+ document.removeEventListener('mousedown', onOutsideClicked);
25
+ };
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ }, []);
28
+ }
29
+ //# sourceMappingURL=useClickedOutsideElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useClickedOutsideElement.js","sourceRoot":"","sources":["../../src/hooks/useClickedOutsideElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,wBAAwB,CACtC,UAAwC,EACxC,kBAAoC;IAEpC,KAAK,CAAC,SAAS,CAAC;QACd,SAAS,gBAAgB,CAAC,KAAiB;YACzC,IAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,KAAK,CAAC,MAAqB,CAAC,CAAA,EAAE;gBACnD,kBAAkB,EAAE,CAAC;aACtB;QACH,CAAC;QACD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACzD,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;QAC9D,CAAC,CAAC;QACF,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { useEffect } from 'react';
2
+ export function useDeprecatedWarning(componentName) {
3
+ useEffect(function () {
4
+ if (window.location.hostname.includes('localhost')) {
5
+ console.warn("".concat(componentName, " will be deprecated in future versions of Lui. Please see the 'Current Deprecations' page in Lui docs."));
6
+ }
7
+ }, []);
8
+ }
9
+ //# sourceMappingURL=useDeprecatedWarning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeprecatedWarning.js","sourceRoot":"","sources":["../../src/hooks/useDeprecatedWarning.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,UAAU,oBAAoB,CAAC,aAAqB;IACxD,SAAS,CAAC;QACR,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YAClD,OAAO,CAAC,IAAI,CACV,UAAG,aAAa,2GAAwG,CACzH,CAAC;SACH;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
package/dist/index.d.ts CHANGED
@@ -14,22 +14,13 @@ export { LuiTab } from './components/LuiTabs/LuiTab/LuiTab';
14
14
  export { LuiTabsGroup } from './components/LuiTabs/LuiTabsGroup/LuiTabsGroup';
15
15
  export { LuiTabsPanel } from './components/LuiTabs/LuiTabsPanel/LuiTabsPanel';
16
16
  export { LuiTabsPanelSwitch } from './components/LuiTabs/LuiTabsPanelSwitch/LuiTabsPanelSwitch';
17
- export { LuiCommonInputProps, LuiFormikForm, } from './components/LuiFormikForms/LuiFormikForm';
18
17
  export { LuiCheckboxInput } from './components/LuiFormElements/LuiCheckboxInput/LuiCheckboxInput';
19
18
  export { LuiFileInputBox } from './components/LuiFormElements/LuiFileInputBox/LuiFileInputBox';
20
19
  export { LuiSelectInput } from './components/LuiFormElements/LuiSelectInput/LuiSelectInput';
21
20
  export { LuiTextAreaInput } from './components/LuiFormElements/LuiTextAreaInput/LuiTextAreaInput';
22
21
  export { LuiTextInput } from './components/LuiFormElements/LuiTextInput/LuiTextInput';
23
22
  export { LuiRadioInput } from './components/LuiFormElements/LuiRadioInput/LuiRadioInput';
24
- export { LuiFormikCheckbox } from './components/LuiFormikForms/LuiFormikCheckbox/LuiFormikCheckbox';
25
- export { LuiFormikTextInput } from './components/LuiFormikForms/LuiFormikTextInput/LuiFormikTextInput';
26
- export { LuiFormikFormLabel } from './components/LuiFormikForms/LuiFormikFormLabel/LuiFormikFormLabel';
27
- export { LuiFormikRadioButton } from './components/LuiFormikForms/LuiFormikRadioButton/LuiFormikRadioButton';
28
- export { LuiFormikRadioGroup } from './components/LuiFormikForms/LuiFormikRadioGroup/LuiFormikRadioGroup';
29
- export { LuiFormikFormSubmitButton } from './components/LuiFormikForms/LuiFormikFormSubmitButton/LuiFormikFormSubmitButton';
30
- export { LuiFormikSelect } from './components/LuiFormikForms/LuiFormikSelect/LuiFormikSelect';
31
23
  export { LuiIcon } from './components/LuiIcon/LuiIcon';
32
- export { LuiBearingFormikInput, LuiBearingInput, } from './components/LuiBearingInput/LuiBearingInput';
33
24
  export { LuiFooter } from './components/LuiFooter/LuiFooter';
34
25
  export { LuiComboSelect, LuiComboSelectProps, LuiComboSelectOption, } from './components/LuiForms/LuiComboSelect/LuiComboSelect';
35
26
  export { LuiFormSectionHeader, IFormSectionHeaderProps, } from './components/LuiForms/LuiFormSection/LuiFormSectionHeader';