@equinor/amplify-component-lib 13.2.4 → 13.2.5-beta.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.
- package/dist/atoms/hooks/useLocalStorage.d.ts +2 -2
- package/dist/atoms/hooks/useLocalStorage.js +1 -1
- package/dist/atoms/hooks/useSelect.d.ts +3 -3
- package/dist/atoms/index.d.ts +1 -1
- package/dist/atoms/index.js +1 -1
- package/dist/atoms/style/index.d.ts +1 -1
- package/dist/atoms/style/index.js +1 -1
- package/dist/atoms/utils/auth_environment.d.ts +1 -0
- package/dist/atoms/utils/auth_environment.js +1 -1
- package/dist/deprecated/ExpandingIconButton/ExpandingIconButton.d.ts +3 -3
- package/dist/deprecated/IconToggleButton.d.ts +3 -3
- package/dist/deprecated/OldStepper/OldStepLine.js +1 -1
- package/dist/deprecated/OldStepper/OldStepper.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/molecules/AnimatedCheckmark/AnimatedCheckmark.d.ts +1 -1
- package/dist/molecules/ApplicationIcon/ApplicationIcon.d.ts +1 -1
- package/dist/molecules/Badge/Badge.d.ts +1 -1
- package/dist/molecules/Button/Button.js +1 -1
- package/dist/molecules/Button/IconButton/IconButton.js +1 -1
- package/dist/molecules/Chip/Chip.d.ts +3 -3
- package/dist/molecules/Chip/Chip.styles.js +1 -1
- package/dist/molecules/Confetti/Confetti.types.d.ts +1 -1
- package/dist/molecules/Confetti/utils/seasonalColors.js +1 -1
- package/dist/molecules/DatePicker/DatePicker.d.ts +3 -3
- package/dist/molecules/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/molecules/Dialog/Dialog.d.ts +2 -2
- package/dist/molecules/EquinorLogo/EquinorLogo.d.ts +2 -2
- package/dist/molecules/FileProgress/CompactFileProgress.js +1 -1
- package/dist/molecules/FileProgress/FileProgress.types.d.ts +1 -1
- package/dist/molecules/IconCell/IconCell.d.ts +3 -3
- package/dist/molecules/IconCell/IconCell.styles.js +3 -3
- package/dist/molecules/IconCell/IconCell.utils.js +1 -1
- package/dist/molecules/ListItem/ListItem.d.ts +2 -2
- package/dist/molecules/OptionDrawer/OptionDrawer.d.ts +3 -3
- package/dist/molecules/OptionalTooltip/OptionalTooltip.d.ts +4 -4
- package/dist/molecules/ProfileAvatar/ProfileAvatar.d.ts +2 -2
- package/dist/molecules/ProfileAvatar/ProfileAvatar.js +1 -1
- package/dist/molecules/RichTextEditor/custom-extensions/AmplifyKit.js +1 -1
- package/dist/molecules/RichTextEditor/index.d.ts +6 -6
- package/dist/molecules/RichTextEditor/index.js +1 -1
- package/dist/molecules/Search/Search.d.ts +2 -2
- package/dist/molecules/Select/PersistentComboBox/PersistentComboBox.d.ts +2 -2
- package/dist/molecules/Select/Select.js +1 -1
- package/dist/molecules/Select/Select.styles.d.ts +5 -5
- package/dist/molecules/Select/Select.styles.js +31 -13
- package/dist/molecules/Select/Select.types.d.ts +1 -1
- package/dist/molecules/Select/SelectMenuItem.js +1 -1
- package/dist/molecules/Select/SelectMenuItem.utils.js +1 -1
- package/dist/molecules/Select/SingleSelect/SingleSelect.d.ts +2 -2
- package/dist/molecules/SelectionControls/Checkbox/Checkbox.d.ts +2 -2
- package/dist/molecules/SelectionControls/Radio/Radio.d.ts +2 -2
- package/dist/molecules/SelectionControls/Switch/Switch.d.ts +2 -2
- package/dist/molecules/Skeleton/SkeletonBase/SkeletonBase.d.ts +2 -2
- package/dist/molecules/Stepper/Step/Step.js +1 -1
- package/dist/molecules/Stepper/StepLine.js +1 -1
- package/dist/molecules/Stepper/Stepper.js +1 -1
- package/dist/molecules/Tabs/Tab.styles.js +4 -0
- package/dist/molecules/Tabs/Tabs.d.ts +2 -2
- package/dist/molecules/Waves/Waves.d.ts +1 -1
- package/dist/molecules/index.d.ts +1 -1
- package/dist/molecules/index.js +1 -1
- package/dist/organisms/DataGrid/DataGrid.d.ts +2 -2
- package/dist/organisms/Faq/Faq.d.ts +1 -1
- package/dist/organisms/Faq/Faq.utils.js +1 -1
- package/dist/organisms/FieldSelector/ChangingField.js +1 -1
- package/dist/organisms/Filter/AutoCompleteText.js +1 -1
- package/dist/organisms/Filter/Filter.d.ts +2 -2
- package/dist/organisms/Filter/Filter.types.d.ts +1 -1
- package/dist/organisms/Filter/QuickFilter.d.ts +2 -2
- package/dist/organisms/Filter/SortMenu.d.ts +2 -2
- package/dist/organisms/ReleaseNote/ReleaseNote.d.ts +3 -3
- package/dist/organisms/SideBar/MenuItem/MenuItem.d.ts +1 -1
- package/dist/organisms/SideBar/SideBar.d.ts +2 -2
- package/dist/organisms/SideBar/index.d.ts +1 -1
- package/dist/organisms/Status/Action.d.ts +2 -2
- package/dist/organisms/Status/Description.d.ts +2 -2
- package/dist/organisms/Status/MissingAccesses.d.ts +2 -2
- package/dist/organisms/Status/Title.d.ts +2 -2
- package/dist/organisms/Status/collections/BadRequest.d.ts +2 -2
- package/dist/organisms/Status/collections/GenericError.d.ts +2 -2
- package/dist/organisms/Status/collections/MissingPermissions.d.ts +2 -2
- package/dist/organisms/Status/collections/PageNotFound.d.ts +2 -2
- package/dist/organisms/Status/collections/ServerError.d.ts +2 -2
- package/dist/organisms/Status/index.d.ts +1 -1
- package/dist/organisms/Template/Template.d.ts +5 -5
- package/dist/organisms/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/organisms/ToggleGroup/ToggleGroupOption.d.ts +2 -2
- package/dist/organisms/ToggleGroup/ToggleGroupOption.js +1 -1
- package/dist/organisms/TopBar/Account/Account.d.ts +1 -1
- package/dist/organisms/TopBar/Account/AccountButton.js +1 -1
- package/dist/organisms/TopBar/Actions.d.ts +2 -2
- package/dist/organisms/TopBar/FieldMenu/FieldMenu.d.ts +3 -3
- package/dist/organisms/TopBar/Guidelines/Colorbox.d.ts +4 -4
- package/dist/organisms/TopBar/Guidelines/Guidelines.d.ts +1 -1
- package/dist/organisms/TopBar/Notifications/NotificationProvider.d.ts +2 -2
- package/dist/organisms/TopBar/Notifications/NotificationsTemplate/Notifications.types.d.ts +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/Feedback.utils.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/LockedInputTooltip.js +2 -2
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/Severity.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/UploadFile/ImageFile.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/FeedbackForm/UploadFile/UploadFile.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/ResponsePage.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/ResponseStatus.js +1 -1
- package/dist/organisms/TopBar/Resources/Feedback/ResponsePage/Success.js +1 -1
- package/dist/organisms/TopBar/Resources/Resources.d.ts +1 -1
- package/dist/organisms/TopBar/Tutorials/TutorialItem.js +1 -1
- package/dist/organisms/TopBar/index.d.ts +1 -1
- package/dist/organisms/index.d.ts +1 -1
- package/dist/organisms/index.js +1 -1
- package/dist/providers/AuthProvider/AuthProvider.d.ts +26 -3
- package/dist/providers/AuthProvider/AuthProvider.js +1 -1
- package/dist/providers/AuthProvider/AuthProviderInner.js +1 -1
- package/dist/providers/LoadingProvider.js +1 -1
- package/dist/providers/SnackbarProvider/SnackbarProvider.d.ts +1 -1
- package/dist/providers/StepperProvider.d.ts +1 -1
- package/dist/providers/StepperProvider.js +1 -1
- package/dist/providers/TableOfContentsProvider.d.ts +1 -1
- package/dist/providers/TutorialHighlightingProvider/TutorialHighlightingProviderInner.js +1 -1
- package/package.json +9 -9
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react175 from "react";
|
|
2
|
+
import * as styled_components48 from "styled-components";
|
|
3
3
|
import { IStyledComponent } from "styled-components";
|
|
4
|
-
import * as
|
|
4
|
+
import * as styled_components_dist_types40 from "styled-components/dist/types";
|
|
5
5
|
|
|
6
6
|
//#region src/organisms/Template/Template.d.ts
|
|
7
7
|
interface ContentProps {
|
|
8
8
|
$open: boolean;
|
|
9
9
|
}
|
|
10
|
-
declare const Content:
|
|
11
|
-
declare const GlobalStyles:
|
|
10
|
+
declare const Content: styled_components_dist_types40.IStyledComponentBase<"web", styled_components48.FastOmit<styled_components48.FastOmit<react175.DetailedHTMLProps<react175.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$open"> & ContentProps, never> & Partial<Pick<styled_components48.FastOmit<react175.DetailedHTMLProps<react175.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$open"> & ContentProps, never>>> & string;
|
|
11
|
+
declare const GlobalStyles: react175.NamedExoticComponent<styled_components48.ExecutionProps & object>;
|
|
12
12
|
type TemplateType = IStyledComponent<'web', any> & {
|
|
13
13
|
Container: IStyledComponent<'web', any>;
|
|
14
14
|
Content: typeof Content;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToggleGroup as ToggleGroup$1 } from "./ToggleGroup.types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react229 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/ToggleGroup/ToggleGroup.d.ts
|
|
5
|
-
declare const ToggleGroup:
|
|
5
|
+
declare const ToggleGroup: react229.ForwardRefExoticComponent<ToggleGroup$1 & react229.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ToggleGroup };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ToggleGroupOption as ToggleGroupOption$1 } from "./ToggleGroup.types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react227 from "react";
|
|
3
3
|
import { HTMLAttributes } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/organisms/ToggleGroup/ToggleGroupOption.d.ts
|
|
6
6
|
type ToggleGroupOptionProps = ToggleGroupOption$1 & Omit<HTMLAttributes<HTMLButtonElement>, 'onToggle' | 'disabled'>;
|
|
7
|
-
declare const ToggleGroupOption:
|
|
7
|
+
declare const ToggleGroupOption: react227.ForwardRefExoticComponent<ToggleGroupOptionProps & react227.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { ToggleGroupOption };
|
|
@@ -55,4 +55,4 @@ import{colors as e}from"../../atoms/style/colors.js";import{spacings as t}from".
|
|
|
55
55
|
fill: ${e.interactive.disabled__text.rgba};
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
`,d=i(({checked:e,onToggle:t,icon:n,disabled:i,...s},d)=>l(u,{ref:d,"aria-checked":e,onClick:()=>{t(!e)},disabled:i
|
|
58
|
+
`,d=i(({checked:e,onToggle:t,icon:n,disabled:i,...s},d)=>{let f=`tooltip`in s?{...s,tooltip:void 0,toolTipPlacement:void 0}:{...s};return l(u,{ref:d,"aria-checked":e,onClick:()=>{t(!e)},disabled:i,...f,children:[n?`tooltip`in s&&s.tooltip?c(r,{title:s.tooltip,placement:s.tooltipPlacement,children:c(a,{data:n,size:24})}):c(a,{data:n,size:24}):null,`label`in s?c(o,{as:`span`,variant:`button`,group:`navigation`,children:s.label}):null]})});d.displayName=`ToggleGroupOption`;export{d as ToggleGroupOption};
|
|
@@ -6,4 +6,4 @@ import{spacings as e}from"../../../atoms/style/spacings.js";import{useAuth as t}
|
|
|
6
6
|
background: ${({$variant:e})=>s(e).chipBackground};
|
|
7
7
|
outline: none;
|
|
8
8
|
padding: 0;
|
|
9
|
-
`,h=l(({onClick:e,environmentToggle:n},s)=>{let{account:l,photo:u}=t(),{data:h}=i(),g=n.length>0,_=n.map(e=>o(e.value)),v=h?.roles?.sort()??[];return f(p,{children:[v.at(0)&&d(m,{$variant:`impersonate`,children:v[0]}),v.length>1&&d(m,{$variant:`impersonate`,children:`+${v.length-1}`}),g&&_.at(0)&&d(m,{$variant:`environment`,children:_[0]}),_.length>1&&d(m,{$variant:`environment`,children:`+${_.length-1}`}),d(a,{ref:s,onClick:e,children:g&&h?d(c,{size:36,variant:`combined`}):g?d(c,{size:36,name:n.map(e=>e.value).join(`, `),variant:`environment`}):h?d(c,{size:36,variant:`impersonate`}):d(r,{size:36,name:l?.name,url:u})})]})});h.displayName=`AccountButton`;export{h as AccountButton};
|
|
9
|
+
`,h=l(({onClick:e,environmentToggle:n},s)=>{let{account:l,photo:u}=t(),{data:h}=i(),g=n.length>0,_=n.map(e=>o(e.value)),v=h?.roles?.sort()??[];return f(p,{children:[v.at(0)&&d(m,{$variant:`impersonate`,children:v[0]}),v.length>1&&d(m,{$variant:`impersonate`,children:`+${v.length-1}`}),g&&_.at(0)&&d(m,{$variant:`environment`,children:_[0]}),_.length>1&&d(m,{$variant:`environment`,children:`+${_.length-1}`}),d(a,{ref:s,onClick:e,children:g&&h?d(c,{size:36,variant:`combined`}):g?d(c,{size:36,name:n.map(e=>e.value).join(`, `),variant:`environment`}):h?d(c,{size:36,variant:`impersonate`}):d(r,{size:36,name:l?.name,url:u})})]})});h.displayName=`AccountButton`;export{h as AccountButton,m as StatusChip};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react215 from "react";
|
|
2
2
|
import { HTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/TopBar/Actions.d.ts
|
|
5
|
-
declare const Actions:
|
|
5
|
+
declare const Actions: react215.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react215.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Actions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field } from "../../../atoms/types/Field.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react213 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/TopBar/FieldMenu/FieldMenu.d.ts
|
|
5
5
|
interface FieldMenuProps {
|
|
@@ -8,6 +8,6 @@ interface FieldMenuProps {
|
|
|
8
8
|
itemNameSingular?: string;
|
|
9
9
|
showAccessITLink?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare const FieldMenu:
|
|
11
|
+
declare const FieldMenu: react213.ForwardRefExoticComponent<FieldMenuProps & react213.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { FieldMenu };
|
|
13
|
+
export { FieldMenu, FieldMenuProps };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
1
|
+
import * as react236 from "react";
|
|
2
|
+
import * as styled_components61 from "styled-components";
|
|
3
|
+
import * as styled_components_dist_types46 from "styled-components/dist/types";
|
|
4
4
|
|
|
5
5
|
//#region src/organisms/TopBar/Guidelines/Colorbox.d.ts
|
|
6
6
|
interface ColorboxProps {
|
|
7
7
|
$color: string;
|
|
8
8
|
}
|
|
9
|
-
declare const Colorbox:
|
|
9
|
+
declare const Colorbox: styled_components_dist_types46.IStyledComponentBase<"web", styled_components61.FastOmit<styled_components61.FastOmit<react236.DetailedHTMLProps<react236.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color"> & ColorboxProps, never> & Partial<Pick<styled_components61.FastOmit<react236.DetailedHTMLProps<react236.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color"> & ColorboxProps, never>>> & string;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Colorbox };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react235 from "react";
|
|
2
2
|
import { Dispatch, FC, ReactNode, SetStateAction } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/organisms/TopBar/Notifications/NotificationProvider.d.ts
|
|
@@ -6,7 +6,7 @@ interface NotificationContext {
|
|
|
6
6
|
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
7
7
|
isOpen: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare const NotificationContext:
|
|
9
|
+
declare const NotificationContext: react235.Context<NotificationContext | undefined>;
|
|
10
10
|
declare const useNotification: () => NotificationContext;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { useNotification };
|
|
@@ -83,4 +83,4 @@ type ExperienceReadyToPublishTypes = {
|
|
|
83
83
|
notificationType: NotificationsTypes.EXPERIENCE_READY_TO_PUBLISH;
|
|
84
84
|
} & NotificationDto;
|
|
85
85
|
//#endregion
|
|
86
|
-
export { DefaultNotificationTypes, Due3WeeksTypes, ExperienceReadyToPublishTypes, MergeBranchOrcaTypes, ReadyToReportNotificationTypes, RequestChangeOrcaTypes, RequestReviewOrcaTypes, ReviewQANotificationsTypes };
|
|
86
|
+
export { DefaultNotificationTypes, Due3WeeksTypes, ExperienceReadyToPublishTypes, MergeBranchOrcaTypes, NotificationDto, NotificationExperienceDto, NotificationsTypes, ReadyToReportNotificationTypes, RequestChangeOrcaTypes, RequestReviewOrcaTypes, ReviewQANotificationsTypes, SignalRMessage, TagDto, userNotification };
|
|
@@ -5,4 +5,4 @@ import"../../../../atoms/enums/Environment.js";import{environment as e}from"../.
|
|
|
5
5
|
${e.description} \n \n User agent string: ${navigator.userAgent}`},p=(e,t)=>{let n=t?`selfservice?id=ticket&table=incident&sys_id=`:`now/nav/ui/classic/params/target/incident.do%3Fsys_id%3D`;return`https://equinor${s(import.meta.env.VITE_ENVIRONMENT_NAME)===`production`?``:`test`}.service-now.com/${n}${e}`},m=()=>{if(navigator.userAgent.includes(`Edg`))return`Edge`;if(navigator.userAgent.includes(`Chrome`))return`Chrome`;if(navigator.userAgent.includes(`Safari`))return`Safari`;if(navigator.userAgent.includes(`Firefox`))return`Firefox`},h=e=>{let t=e;e===`Edge`&&(t=`Edg`);let n=RegExp(`${t}/(\\d+(?:\\.\\d+)+)`);return navigator.userAgent.match(n)?.[1]},g=()=>{let e=m();return e?`${e} (${h(e)})`:`Not found`},_=(e,r,i,s,l)=>{let u=i===a.BUG?`:bug: Bug report`:`:bulb: Suggestion`,f=[],m=[];m.push({type:`mrkdwn`,text:`*Title* \n ${e.title}`}),f.push({type:`mrkdwn`,text:` ${t(new Date,{format:`DD. month YYYY`})}`}),e.url&&f.push({type:`mrkdwn`,text:`*<${e.url}|Error URL>*`}),e.urgency&&m.push({type:`mrkdwn`,text:`*Severity* \n ${c(e)} ${d(e.urgency)}`});let h=[{type:`header`,text:{type:`plain_text`,text:u,emoji:!0}},{type:`section`,fields:f},{type:`section`,fields:m},{type:`section`,fields:[{type:`mrkdwn`,text:`*Application*
|
|
6
6
|
`+o(import.meta.env.VITE_NAME)},{type:`mrkdwn`,text:`*User* \n ${s}`}]},{type:`section`,fields:[{type:`mrkdwn`,text:`*Browser*
|
|
7
7
|
`+g()},{type:`mrkdwn`,text:`*Field* \n ${n(r??`Not found`)}`}]},{type:`section`,text:{type:`mrkdwn`,text:`*Description*
|
|
8
|
-
`+e.description}}];return l&&h.push({type:`section`,text:{type:`mrkdwn`,text:`*<${p(l)}|:link: Click to open the ticket in Service Now>*`}}),h.push({type:`divider`}),JSON.stringify(h)};export{f as createServiceNowDescription,p as createServiceNowUrl,_ as createSlackMessage,g as getBrowserInfo,u as getServiceNowUrgencyNumber,d as getUrgencyDisplayText,l as readUploadedFileAsText};
|
|
8
|
+
`+e.description}}];return l&&h.push({type:`section`,text:{type:`mrkdwn`,text:`*<${p(l)}|:link: Click to open the ticket in Service Now>*`}}),h.push({type:`divider`}),JSON.stringify(h)};export{f as createServiceNowDescription,p as createServiceNowUrl,_ as createSlackMessage,g as getBrowserInfo,u as getServiceNowUrgencyNumber,c as getSeverityEmoji,d as getUrgencyDisplayText,l as readUploadedFileAsText};
|
|
@@ -2,6 +2,6 @@ import{OptionalTooltip as e}from"../../../../../molecules/OptionalTooltip/Option
|
|
|
2
2
|
white-space: break-spaces;
|
|
3
3
|
text-align: center;
|
|
4
4
|
width: 400px;
|
|
5
|
-
`,o=t(({show:e,children:t},r)=>
|
|
5
|
+
`,o=t(({show:e,children:t},r)=>{let o=n(()=>e?`The report was successfully submitted to ServiceNow.
|
|
6
6
|
This field is locked so you can retry sending it to the development team.
|
|
7
|
-
To reset the form, use the button in the bottom left corner.`:``,[e]),children:i(`div`,{ref:r,children:t})}));o.displayName=`LockedInputTooltip`;export{o as LockedInputTooltip};
|
|
7
|
+
To reset the form, use the button in the bottom left corner.`:``,[e]);return i(a,{title:o,children:i(`div`,{ref:r,children:t})})});o.displayName=`LockedInputTooltip`;export{o as LockedInputTooltip};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{SingleSelect as e}from"../../../../../molecules/Select/SingleSelect/SingleSelect.js";import{SORTED_BUG_SEVERITY_OPTIONS as t}from"../Feedback.const.js";import{getUrgencyDisplayText as n}from"../Feedback.utils.js";import{useFeedbackContext as r}from"../hooks/useFeedbackContext.js";import{LockedInputTooltip as i}from"./LockedInputTooltip.js";import a from"styled-components";import{jsx as o}from"react/jsx-runtime";const s=a.div`
|
|
2
2
|
grid-column: 1/2;
|
|
3
|
-
`,c=t.map(e=>({value:e,label:n(e)})),l=()=>{let{serviceNowSuccess:t,feedbackContent:a,updateFeedback:l}=r();return o(s,{children:o(i,{show:t,children:o(e,{items:c,label:`Severity`,meta:`optional`,clearable:!0,disabled:t,value:
|
|
3
|
+
`,c=t.map(e=>({value:e,label:n(e)})),l=()=>{let{serviceNowSuccess:t,feedbackContent:a,updateFeedback:l}=r(),u=a.urgency?{value:a.urgency,label:n(a.urgency)}:void 0;return o(s,{children:o(i,{show:t,children:o(e,{items:c,label:`Severity`,meta:`optional`,clearable:!0,disabled:t,value:u,placeholder:`Select error impact`,onSelect:e=>{l(`urgency`,e?.value)}})})})};export{l as Severity};
|
|
@@ -4,4 +4,4 @@ import{tokens as e}from"../../../../../../node_modules/@equinor/eds-tokens/dist/
|
|
|
4
4
|
width: 82px;
|
|
5
5
|
height: 82px;
|
|
6
6
|
position: relative;
|
|
7
|
-
`,_=e=>{let[u,_]=c(``),{error:v,onDelete:y}=e,b=s(()=>{if(!v)return;let t=e.errors[0].code,n=e.errors[0].message;return t===`file-too-large`?n=n.replace(/(\d+ bytes)/,`1MB`):t===`file-invalid-type`&&(n=n.replace(/(\w+\/\w+,)/g,``).replaceAll(`,`,`, `)),`${e.errors[0].code} \n${n}`},[v,e]),x=s(()=>e.file.name,[v,e]),S=s(()=>v?e.errors.find(e=>e.code.includes(`invalid`))?`Invalid file type`:e.errors.find(e=>e.code.includes(`large`))?`Invalid file size`:`Error`:``,[v,e]);return o(()=>{v||(async e=>{
|
|
7
|
+
`,_=e=>{let[u,_]=c(``),{error:v,onDelete:y}=e,b=s(()=>{if(!v)return;let t=e.errors[0].code,n=e.errors[0].message;return t===`file-too-large`?n=n.replace(/(\d+ bytes)/,`1MB`):t===`file-invalid-type`&&(n=n.replace(/(\w+\/\w+,)/g,``).replaceAll(`,`,`, `)),`${e.errors[0].code} \n${n}`},[v,e]),x=s(()=>e.file.name,[v,e]),S=s(()=>v?e.errors.find(e=>e.code.includes(`invalid`))?`Invalid file type`:e.errors.find(e=>e.code.includes(`large`))?`Invalid file size`:`Error`:``,[v,e]);return o(()=>{v||(async e=>{let n=await t(e);_(n)})(e.file)},[v,e]),f(g,{children:[d(r,{title:`${x}${v?`: `+b:``}`,children:v?f(a,{children:[d(l,{data:m,color:h.interactive.warning__text.rgba}),d(`div`,{children:S})]}):d(i,{children:d(`img`,{src:u,alt:`Uploaded file: ${x}`})})}),d(n,{"data-testid":`attachment-delete-button`,onClick:y,children:d(l,{color:h.text.static_icons__tertiary.rgba,data:p,size:24})})]})};export{_ as ImageFile};
|
|
@@ -2,4 +2,4 @@ import{FileUploadArea as e}from"../../../../../../molecules/FileUploadArea/FileU
|
|
|
2
2
|
grid-column: 1/3;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
`;function d(e,t){if(e.length===0||e.length===1)return e;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t(e[n],e[r])&&e.splice(n,1);return e}const f=()=>{let{feedbackAttachments:s,setFeedbackAttachments:f}=n(),[p,m]=o([]),h=(e,t)=>{if(e.length>=1){let t=e.filter(e=>!e.name.startsWith(`.`));new FileReader().readAsDataURL(e[0]);let n=[];s&&n.push(...s)
|
|
5
|
+
`;function d(e,t){if(e.length===0||e.length===1)return e;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t(e[n],e[r])&&e.splice(n,1);return e}const f=()=>{let{feedbackAttachments:s,setFeedbackAttachments:f}=n(),[p,m]=o([]),h=(e,t)=>{if(e.length>=1){let t=e.filter(e=>!e.name.startsWith(`.`));new FileReader().readAsDataURL(e[0]);let n=[];s&&n.push(...s);let r=d([...t,...n],(e,t)=>e.name===t.name&&e.size===t.size);f(r)}m(t)},g=e=>{let t=s?.filter(t=>t.name!==e.name&&t.size!==e.size)??[];f(t)},_=e=>{m(p?.filter(t=>t.file.name===e.file.name&&t.file.size!==e.file.size)??[])};return l(u,{children:[c(i,{group:`input`,variant:`label`,children:`Attachments (.jpg, .jpeg, .png) (max 1 MB)`}),l(r,{children:[c(e,{maxSize:t,onDrop:h,accept:{"image/jpeg":[`.jpeg`,`.jpg`],"image/png":[`.png`]},size:`small`}),s?.map(e=>c(a,{onDelete:()=>g(e),file:e},e.name+e.size)),p.map(e=>c(a,{...e,onDelete:()=>_(e),error:!0},e.file.name+e.file.size))]})]})};export{u as Container,f as UploadFile};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{spacings as e}from"../../../../../atoms/style/spacings.js";import{useFeedbackContext as t}from"../hooks/useFeedbackContext.js";import{ContentWrapper as n}from"../Feedback.styles.js";import{AnimateChangeInHeight as r}from"./AnimateChangeInHeight.js";import i
|
|
1
|
+
import{spacings as e}from"../../../../../atoms/style/spacings.js";import{useFeedbackContext as t}from"../hooks/useFeedbackContext.js";import{ContentWrapper as n}from"../Feedback.styles.js";import{AnimateChangeInHeight as r}from"./AnimateChangeInHeight.js";import{ResponseStatus as i}from"./ResponseStatus.js";import{Success as a}from"./Success.js";import{useEffect as o,useState as s}from"react";import{Button as c}from"@equinor/eds-core-react";import l from"styled-components";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{motion as f}from"motion/react";const p=l(f.div)`
|
|
2
2
|
display: flex;
|
|
3
3
|
gap: ${e.large};
|
|
4
4
|
height: auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useFeedbackContext as e}from"../hooks/useFeedbackContext.js";import{RequestStatus as t}from"./RequestStatus.js";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";import{WorkItemType as a}from"@equinor/subsurface-app-management";const o=()=>{let{serviceNowRequestResponse:o,workItemRequestResponse:s,selectedType:c}=e();return i(n,{children:[c===a.BUG&&r(t,{title:`Service Now`,requestStatus:o}),r(t,{title:`Development team`,requestStatus:s})]})};export{o as default};
|
|
1
|
+
import{useFeedbackContext as e}from"../hooks/useFeedbackContext.js";import{RequestStatus as t}from"./RequestStatus.js";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";import{WorkItemType as a}from"@equinor/subsurface-app-management";const o=()=>{let{serviceNowRequestResponse:o,workItemRequestResponse:s,selectedType:c}=e();return i(n,{children:[c===a.BUG&&r(t,{title:`Service Now`,requestStatus:o}),r(t,{title:`Development team`,requestStatus:s})]})};export{o as ResponseStatus,o as default};
|
|
@@ -6,4 +6,4 @@ import{tokens as e}from"../../../../../node_modules/@equinor/eds-tokens/dist/esm
|
|
|
6
6
|
padding-left: ${t.large};
|
|
7
7
|
font-weight: 400;
|
|
8
8
|
font-size: 16px;
|
|
9
|
-
`,d=()=>{let{selectedType:e,serviceNowUrl:t}=n();return o(l,{children:[a(r,{variant:`h3`,children:`Thank you, we have received your ${e===s.BUG?`report!`:`suggestion!`}`}),e===s.BUG&&t.length>0&&a(u,{href:t,children:`See ticket in ServiceNow`})]})};export{d as Success};
|
|
9
|
+
`,d=()=>{let{selectedType:e,serviceNowUrl:t}=n();return o(l,{children:[a(r,{variant:`h3`,children:`Thank you, we have received your ${e===s.BUG?`report!`:`suggestion!`}`}),e===s.BUG&&t.length>0&&a(u,{href:t,children:`See ticket in ServiceNow`})]})};export{u as ServiceNowLink,d as Success};
|
|
@@ -18,4 +18,4 @@ import{animation as e}from"../../../atoms/style/animation.js";import{colors as t
|
|
|
18
18
|
&:hover {
|
|
19
19
|
background: ${t.interactive.primary__hover_alt.rgba};
|
|
20
20
|
}
|
|
21
|
-
`,f=({onTutorialStart:e,onClose:n,id:a,name:f})=>{let{startTutorial:p,seenTutorialIDs:m}=u();return s(d,{onClick:()=>{p(a),e?.(a),n()},children:[
|
|
21
|
+
`,f=({onTutorialStart:e,onClose:n,id:a,name:f})=>{let{startTutorial:p,seenTutorialIDs:m}=u(),h=m.includes(a);return s(d,{onClick:()=>{p(a),e?.(a),n()},children:[h&&s(`header`,{children:[o(r,{data:c,size:16,color:t.interactive.primary__resting.rgba}),o(i,{varinat:`caption`,children:`COMPLETED`})]}),o(i,{variant:`h4`,children:f}),o(r,{data:l,color:t.interactive.primary__resting.rgba})]})};export{f as TutorialItem};
|
|
@@ -24,4 +24,4 @@ import { Faq } from "./Faq/Faq.js";
|
|
|
24
24
|
import { ReleaseNotesPage } from "./ReleaseNotesPage/ReleaseNotesPage.js";
|
|
25
25
|
import { Card as Card$1, CardProps } from "@equinor/eds-core-react";
|
|
26
26
|
import { EdsDataGridProps as DataGridProps } from "@equinor/eds-data-grid-react";
|
|
27
|
-
export { Card$1 as Card, type CardProps, type DataGridProps };
|
|
27
|
+
export { ApiResponseError, BadRequest, Card$1 as Card, type CardProps, type ContentProps, DataGrid, type DataGridProps, Faq, FieldSelector, type FieldSelectorProps, Filter, FilterType, GenericError, type GuidelineSections, type ItemType, MissingAccessToApp, MissingPermissions, PageNotFound, PageTitle, ReleaseNote, type ReleaseNoteProps, ReleaseNotesPage, ServerError, type SettingsSection, SideBar, SideSheet, type SideSheetProps, Status, TableOfContents, type TableOfContentsProps, Template, type TemplateType, ToggleGroup, TopBar$1 as TopBar };
|
package/dist/organisms/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Status/index.js";import"./Status/collections/MissingAccessToApp.js";import"./DataGrid/DataGrid.js";import"./Template/Template.js";import"./FieldSelector/FieldSelector.js";import"./Filter/index.js";import"./SideBar/index.js";import"./ReleaseNote/ReleaseNote.js";import"./TopBar/index.js";import"./Status/collections/BadRequest.js";import"./Status/collections/GenericError.js";import"./Status/collections/MissingPermissions.js";import"./Status/collections/PageNotFound.js";import"./Status/collections/ServerError.js";import"./Status/collections/ApiResponseError.js";import"./SideSheet/SideSheet.js";import"./TableOfContents/TableOfContents.js";import"./PageTitle/PageTitle.js";import"./ToggleGroup/index.js";import"./Faq/Faq.js";import"./ReleaseNotesPage/ReleaseNotesPage.js";import{Card as
|
|
1
|
+
import{Status as e}from"./Status/index.js";import{MissingAccessToApp as t}from"./Status/collections/MissingAccessToApp.js";import{DataGrid as n}from"./DataGrid/DataGrid.js";import{Template as r}from"./Template/Template.js";import{FieldSelector as i}from"./FieldSelector/FieldSelector.js";import{Filter as a}from"./Filter/index.js";import{SideBar as o}from"./SideBar/index.js";import{ReleaseNote as s}from"./ReleaseNote/ReleaseNote.js";import{TopBar as c}from"./TopBar/index.js";import{BadRequest as l}from"./Status/collections/BadRequest.js";import{GenericError as u}from"./Status/collections/GenericError.js";import{MissingPermissions as d}from"./Status/collections/MissingPermissions.js";import{PageNotFound as f}from"./Status/collections/PageNotFound.js";import{ServerError as p}from"./Status/collections/ServerError.js";import{ApiResponseError as m}from"./Status/collections/ApiResponseError.js";import{SideSheet as h}from"./SideSheet/SideSheet.js";import{TableOfContents as g}from"./TableOfContents/TableOfContents.js";import{PageTitle as _}from"./PageTitle/PageTitle.js";import{ToggleGroup as v}from"./ToggleGroup/index.js";import{Faq as y}from"./Faq/Faq.js";import{ReleaseNotesPage as b}from"./ReleaseNotesPage/ReleaseNotesPage.js";import{Card as x}from"@equinor/eds-core-react";export{m as ApiResponseError,l as BadRequest,x as Card,n as DataGrid,y as Faq,i as FieldSelector,a as Filter,u as GenericError,t as MissingAccessToApp,d as MissingPermissions,f as PageNotFound,_ as PageTitle,s as ReleaseNote,b as ReleaseNotesPage,p as ServerError,o as SideBar,h as SideSheet,e as Status,g as TableOfContents,r as Template,v as ToggleGroup,c as TopBar};
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { FC, ReactElement, ReactNode } from "react";
|
|
2
|
-
import { AccountInfo } from "@azure/msal-browser";
|
|
2
|
+
import { AccountInfo, AuthenticationResult } from "@azure/msal-browser";
|
|
3
3
|
|
|
4
4
|
//#region src/providers/AuthProvider/AuthProvider.d.ts
|
|
5
|
-
type AuthState = 'loading' | 'authorized' | 'unauthorized';
|
|
5
|
+
type AuthState = 'loading' | 'authorized' | 'unauthorized' | 'interactionRequired';
|
|
6
6
|
interface AuthContextType {
|
|
7
7
|
account: AccountInfo | undefined;
|
|
8
8
|
photo: string | undefined;
|
|
9
9
|
roles: string[] | undefined;
|
|
10
10
|
logout: () => void;
|
|
11
11
|
authState: AuthState;
|
|
12
|
+
/**
|
|
13
|
+
* Trigger an interactive popup login. Useful when silent auth cannot
|
|
14
|
+
* complete (e.g. embedded in an iframe where third-party cookies are
|
|
15
|
+
* blocked). On success the context transitions to `authorized` in place,
|
|
16
|
+
* with roles populated, without requiring a page reload.
|
|
17
|
+
*/
|
|
18
|
+
login: () => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Acquire a token interactively (popup) for the given scopes, falling back
|
|
21
|
+
* to the configured API scope when none are provided.
|
|
22
|
+
*/
|
|
23
|
+
acquireToken: (scopes?: string[]) => Promise<AuthenticationResult | null>;
|
|
12
24
|
}
|
|
13
25
|
declare const useAuth: () => AuthContextType;
|
|
14
26
|
interface AuthProviderProps {
|
|
@@ -17,6 +29,13 @@ interface AuthProviderProps {
|
|
|
17
29
|
unauthorizedComponent?: ReactElement;
|
|
18
30
|
withoutLoader?: boolean;
|
|
19
31
|
withoutBackend?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Redirect URI used only for interactive popups (`login`, `acquireToken`).
|
|
34
|
+
* Point this at a minimal blank page (served by the app and registered as a
|
|
35
|
+
* SPA redirect URI in Azure AD) so the sign-in popup resolves without booting
|
|
36
|
+
* the full app. Falls back to `window.location.origin` when omitted.
|
|
37
|
+
*/
|
|
38
|
+
popupRedirectUri?: string;
|
|
20
39
|
}
|
|
21
40
|
/**
|
|
22
41
|
* @param children - ReactNode
|
|
@@ -24,7 +43,11 @@ interface AuthProviderProps {
|
|
|
24
43
|
* @param unauthorizedComponent - Component to show if user is unauthorized
|
|
25
44
|
* @param withoutLoader - Hide loader from AuthProvider
|
|
26
45
|
* @param withoutBackend - Will not attempt to get roles from backend
|
|
46
|
+
* @param popupRedirectUri - Redirect URI used only for interactive popups
|
|
47
|
+
* (`login`, `acquireToken`). Point this at a minimal blank page so the
|
|
48
|
+
* sign-in popup resolves without booting the full app. Falls back to
|
|
49
|
+
* `window.location.origin` when omitted.
|
|
27
50
|
*/
|
|
28
51
|
declare const AuthProvider: FC<AuthProviderProps>;
|
|
29
52
|
//#endregion
|
|
30
|
-
export { AuthProvider, useAuth };
|
|
53
|
+
export { AuthContextType, AuthProvider, AuthState, useAuth };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{AuthProviderInner as n}from"./AuthProviderInner.js";import{createContext as r,useContext as i,useMemo as a,useState as o}from"react";import{MsalProvider as s}from"@azure/msal-react";import{jsx as c}from"react/jsx-runtime";const{msalApp:
|
|
1
|
+
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{AuthProviderInner as n}from"./AuthProviderInner.js";import{createContext as r,useContext as i,useMemo as a,useState as o}from"react";import{MsalProvider as s}from"@azure/msal-react";import{jsx as c}from"react/jsx-runtime";import{jwtDecode as l}from"jwt-decode";const{msalApp:u,GRAPH_REQUESTS_LOGIN:d,GRAPH_REQUESTS_BACKEND:f}=e,{getIsMock:p,getMockUserPhoto:m,getMockRoles:h,getApiScope:g}=t,_=r(void 0),v=()=>{let e=i(_);if(e===void 0)throw Error(`useAuth must be used within a AuthContext provider`);return e},y={homeAccountId:`mock-home-account-id`,environment:`mock`,tenantId:`mock-tenant-id`,username:`MOCK@equinor.com`,localAccountId:`mock-local-account-id`,name:`Mock mocksnes`,idToken:`fake`,idTokenClaims:{id:`claim`},nativeAccountId:`accountid`,authorityType:`authority`,tenantProfiles:new Map},b=({children:e,loadingComponent:t,unauthorizedComponent:r,withoutLoader:i=!1,withoutBackend:v=!1,popupRedirectUri:b})=>{let[x,S]=o(void 0),[C,w]=o(),[T,E]=o(`loading`),[D,O]=o(),k=a(()=>p(import.meta.env.VITE_IS_MOCK),[]),A=a(()=>m(import.meta.env.VITE_MOCK_USER_PHOTO),[]),j=a(()=>h(import.meta.env.VITE_MOCK_ROLES),[]),M=a(()=>g(import.meta.env.VITE_API_SCOPE),[]),N=a(()=>[...d.scopes,M],[M]),P=b??window.location.origin;return k?(T===`loading`&&setTimeout(()=>{E(`authorized`)},1e3),c(_.Provider,{value:{roles:j,account:y,photo:A,logout:()=>console.log(`Logged out the user!`),authState:T,login:()=>(E(`authorized`),Promise.resolve()),acquireToken:()=>Promise.resolve(null)},children:e})):c(_.Provider,{value:{roles:C,account:x,photo:D,logout:()=>u.logoutRedirect(),authState:T,login:async()=>{let e=await u.loginPopup({scopes:N,redirectUri:P});e.account&&(u.setActiveAccount(e.account),S(e.account));try{let e=l((await u.acquireTokenSilent(f(M))).accessToken);e.roles&&e.roles.length>0?(w(e.roles),E(`authorized`)):(w(void 0),E(`unauthorized`))}catch(e){throw console.error(`[AuthProvider] Could not acquire roles after interactive login`,e),e}},acquireToken:async e=>{try{return await u.acquireTokenPopup({scopes:e??[M],redirectUri:P})}catch(e){return console.error(`[AuthProvider] acquireTokenPopup failed`,e),null}}},children:c(s,{instance:u,children:c(n,{loadingComponent:t,unauthorizedComponent:r,account:x,setAccount:S,setRoles:w,setPhoto:O,authState:T,setAuthState:E,withoutLoader:i,withoutBackend:v,children:e})})})};export{b as AuthProvider,y as MOCK_USER,v as useAuth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{FullPageSpinner as n}from"../../molecules/FullPageSpinner/FullPageSpinner.js";import{MissingAccessToApp as r}from"../../organisms/Status/collections/MissingAccessToApp.js";import{useEffect as i,useRef as a,useState as o}from"react";import{useMsal as s,useMsalAuthentication as c}from"@azure/msal-react";import{BrowserAuthError as l,BrowserAuthErrorCodes as u,InteractionRequiredAuthError as d,InteractionType as f}from"@azure/msal-browser";import{jsx as p}from"react/jsx-runtime";import{jwtDecode as m}from"jwt-decode";const{GRAPH_ENDPOINTS:h,GRAPH_REQUESTS_LOGIN:g,GRAPH_REQUESTS_PHOTO:_,GRAPH_REQUESTS_BACKEND:v,fetchMsGraph:y,isInIframe:b}=e,{getApiScope:x}=t,S=({children:e,account:t,setAccount:S,setPhoto:C,setRoles:w,authState:T,setAuthState:E,withoutLoader:D,loadingComponent:O,unauthorizedComponent:k,withoutBackend:A})=>{let{instance:j,accounts:M,inProgress:N}=s(),{login:P,result:F,error:I,acquireToken:L}=c(f.Silent,g),[R,z]=o(!1),B=a(!1);return i(()=>{R||(async()=>{console.log(`[AuthProvider] Initializing`),await j.initialize(),console.log(`[AuthProvider] Finished initializing`),z(!0)})().catch(e=>{console.error(`[AuthProvider] Error during initialization`,e)})},[j,R]),i(()=>{R&&(I instanceof d&&!b()&&T!==`unauthorized`?(console.error(I),console.log(`[AuthProvider] No account found, need to login via. redirect`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):F?.account&&!t?(console.log(`[AuthProvider] Found account in useMsalAuth result, setting that one as active`),j.setActiveAccount(F.account),S(F.account)):M.length>0&&!t?(console.log(`[AuthProvider] Found account in accounts array, setting that one as active`),j.setActiveAccount(M[0]),S(M[0])):I instanceof l&&I.errorCode===u.monitorWindowTimeout?(console.error(I),console.log(`[AuthProvider] Trying to login again via. redirect due to monitor window timeout`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):I&&console.error(`[AuthProvider] Unexpected error:`,I))},[t,M,I,j,R,P,F,S,T]),i(()=>{if(!t||!R||B.current||N!==`none`)return;B.current=!0;let e=async()=>{try{let e=await L(f.Silent,_);if(e){let t=await y(h.PHOTO,e.accessToken);if(t.status===404)return null;let n=await t.blob();C((window.URL??window.webkitURL).createObjectURL(n))}}catch(e){console.error(e)}},n=async()=>{try{let e=await L(f.Silent,v(x(import.meta.env.VITE_API_SCOPE)));if(console.log(`[AuthProvider] Successfully acquired token`),e&&e.accessToken){console.log(`[AuthProvider] Decoding token`);let t=m(e.accessToken);if(console.log(`[AuthProvider] Token was valid`),t.roles)console.log(`[AuthProvider] Found roles`),w(t.roles);else throw Error(`Could not find roles in token`);E(`authorized`)}}catch(e){console.error(`[AuthProvider] Token error when trying to get roles!`,e),E(`unauthorized`)}};(async()=>{await e(),A?E(`authorized`):await n()})()},[t,L,I,R,N,E,C,w,A]),T===`unauthorized`?k??p(r,{}):D?e:T===`loading`||t===void 0?O??p(n,{variant:`application`}):e};export{S as AuthProviderInner};
|
|
1
|
+
import{auth as e,environment as t}from"../../atoms/utils/auth_environment.js";import{FullPageSpinner as n}from"../../molecules/FullPageSpinner/FullPageSpinner.js";import{MissingAccessToApp as r}from"../../organisms/Status/collections/MissingAccessToApp.js";import{useEffect as i,useRef as a,useState as o}from"react";import{useMsal as s,useMsalAuthentication as c}from"@azure/msal-react";import{BrowserAuthError as l,BrowserAuthErrorCodes as u,InteractionRequiredAuthError as d,InteractionType as f}from"@azure/msal-browser";import{jsx as p}from"react/jsx-runtime";import{jwtDecode as m}from"jwt-decode";const{GRAPH_ENDPOINTS:h,GRAPH_REQUESTS_LOGIN:g,GRAPH_REQUESTS_PHOTO:_,GRAPH_REQUESTS_BACKEND:v,fetchMsGraph:y,isInIframe:b}=e,{getApiScope:x}=t,S=({children:e,account:t,setAccount:S,setPhoto:C,setRoles:w,authState:T,setAuthState:E,withoutLoader:D,loadingComponent:O,unauthorizedComponent:k,withoutBackend:A})=>{let{instance:j,accounts:M,inProgress:N}=s(),{login:P,result:F,error:I,acquireToken:L}=c(f.Silent,g),[R,z]=o(!1),B=a(!1);return i(()=>{R||(async()=>{console.log(`[AuthProvider] Initializing`),await j.initialize(),console.log(`[AuthProvider] Finished initializing`),z(!0)})().catch(e=>{console.error(`[AuthProvider] Error during initialization`,e)})},[j,R]),i(()=>{R&&(I instanceof d&&!b()&&T!==`unauthorized`?(console.error(I),console.log(`[AuthProvider] No account found, need to login via. redirect`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):I instanceof d&&b()&&T!==`unauthorized`&&T!==`authorized`?(console.log(`[AuthProvider] Interaction required in iframe, awaiting interactive login()`),E(`interactionRequired`)):F?.account&&!t?(console.log(`[AuthProvider] Found account in useMsalAuth result, setting that one as active`),j.setActiveAccount(F.account),S(F.account)):M.length>0&&!t?(console.log(`[AuthProvider] Found account in accounts array, setting that one as active`),j.setActiveAccount(M[0]),S(M[0])):I instanceof l&&I.errorCode===u.monitorWindowTimeout?(console.error(I),console.log(`[AuthProvider] Trying to login again via. redirect due to monitor window timeout`),P(f.Redirect,g).catch(e=>{console.error(`[AuthProvider] Error during login`,e)})):I&&console.error(`[AuthProvider] Unexpected error:`,I))},[t,M,I,j,R,P,F,S,E,T]),i(()=>{if(!t||!R||B.current||N!==`none`)return;B.current=!0;let e=async()=>{try{let e=await L(f.Silent,_);if(e){let t=await y(h.PHOTO,e.accessToken);if(t.status===404)return null;let n=await t.blob();C((window.URL??window.webkitURL).createObjectURL(n))}}catch(e){console.error(e)}},n=async()=>{try{let e=await L(f.Silent,v(x(import.meta.env.VITE_API_SCOPE)));if(console.log(`[AuthProvider] Successfully acquired token`),e&&e.accessToken){console.log(`[AuthProvider] Decoding token`);let t=m(e.accessToken);if(console.log(`[AuthProvider] Token was valid`),t.roles)console.log(`[AuthProvider] Found roles`),w(t.roles);else throw Error(`Could not find roles in token`);E(`authorized`)}}catch(e){console.error(`[AuthProvider] Token error when trying to get roles!`,e),e instanceof d&&b()?E(`interactionRequired`):E(`unauthorized`)}};(async()=>{await e(),A?E(`authorized`):await n()})()},[t,L,I,R,N,E,C,w,A]),T===`unauthorized`?k??p(r,{}):T===`interactionRequired`||D?e:T===`loading`||t===void 0?O??p(n,{variant:`application`}):e};export{S as AuthProviderInner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FullPageSpinner as e}from"../molecules/FullPageSpinner/FullPageSpinner.js";import{useAuth as t}from"./AuthProvider/AuthProvider.js";import{useEffect as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{SAM_QUERIES as a}from"@equinor/subsurface-app-management";import{useIsFetching as o}from"@tanstack/react-query";const s=({customQueryKeys:s=[],children:c})=>{let{authState:l}=t(),u=o({predicate:e=>a.some(t=>e.queryKey.includes(t))||s.some(t=>e.queryKey.includes(t))})>0,[d,f]=r(!0);return n(()=>{l===`authorized`&&!u&&d&&f(!1)},[l,u,d]),l===`authorized`?d?i(e,{variant:`application`,fixedPosition:!0,children:c}):c:i(e,{variant:`application`,fixedPosition:!0})};export{s as LoadingProvider};
|
|
1
|
+
import{FullPageSpinner as e}from"../molecules/FullPageSpinner/FullPageSpinner.js";import{useAuth as t}from"./AuthProvider/AuthProvider.js";import{useEffect as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{SAM_QUERIES as a}from"@equinor/subsurface-app-management";import{useIsFetching as o}from"@tanstack/react-query";const s=({customQueryKeys:s=[],children:c})=>{let{authState:l}=t(),u=o({predicate:e=>a.some(t=>e.queryKey.includes(t))||s.some(t=>e.queryKey.includes(t))})>0,[d,f]=r(!0);return n(()=>{l===`authorized`&&!u&&d&&f(!1)},[l,u,d]),l===`interactionRequired`?c:l===`authorized`?d?i(e,{variant:`application`,fixedPosition:!0,children:c}):c:i(e,{variant:`application`,fixedPosition:!0})};export{s as LoadingProvider};
|
|
@@ -29,4 +29,4 @@ type SnackbarProviderProps = {
|
|
|
29
29
|
*/
|
|
30
30
|
declare const SnackbarProvider: FC<SnackbarProviderProps>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { SnackbarProvider, useSnackbar };
|
|
32
|
+
export { ShowSnackbar, ShowSnackbarSettings, SnackbarProvider, SnackbarProviderProps, State, useSnackbar };
|
|
@@ -56,4 +56,4 @@ interface StepperProviderWithoutSyncToURLParamProps extends StepperProviderProps
|
|
|
56
56
|
*/
|
|
57
57
|
declare const StepperProvider: FC<StepperProviderSyncedToURLParamProps | StepperProviderWithoutSyncToURLParamProps>;
|
|
58
58
|
//#endregion
|
|
59
|
-
export { StepperProvider, useStepper };
|
|
59
|
+
export { StepperProvider, StepperProviderProps, useStepper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as e,useCallback as t,useContext as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{useLocation as a,useNavigate as o,useParams as s}from"@tanstack/react-router";const c=e(void 0);function l(){let e=n(c);if(!e)throw Error(`useStepper must be used within a StepperProvider`);return e}const u=({steps:e,children:n,isStepDisabled:l,...u})=>{let{step:d}=s({strict:!1}),f=o(),p=a().pathname.split(`/`).slice(0,-1).join(`/`),m=u.syncToURLParam?Number(d):u?.initialStep??0;if(u.syncToURLParam&&d&&isNaN(Number(d)))throw Error(`Step URL param must be a valid number when using "syncToURLParam"`);if(e.length<2)throw Error(`Stepper must have at least 2 steps`);let[h,g]=r(m),_=u.syncToURLParam?Number(d):h,[v,y]=r(0);if(m>=e.length||m<0)throw Error(`initialStep must be a valid index of the steps array`);let b=t=>{if(t===_)return;if(t>_){v!==0&&y(0);return}let n=e.at(t);if(n&&`subSteps`in n&&n.subSteps&&n.subSteps.length>0){y(n.subSteps.length-1);return}v!==0&&y(0)},x=e=>{b(e),u.syncToURLParam?f({to:`${p}/${e}`}):g(e)},S=()=>{if(`subSteps`in e[_]&&e[_].subSteps&&v<e[_].subSteps.length-1){y(e=>e+1);return}_!==e.length-1&&x(_+1)},C=()=>{if(v>0&&`subSteps`in e[_]&&e[_].subSteps&&e[_].subSteps.length>0){y(e=>e-1);return}_!==0&&x(_-1)},w=t(t=>l?l({step:e[t],stepIndex:t,currentStep:e[_],currentStepIndex:_}):!1,[l,_,e]);return i(c.Provider,{value:{steps:e,currentStep:_,currentSubStep:v,setCurrentStep:x,goToNextStep:S,goToPreviousStep:C,isStepAtIndexDisabled:w},children:n})};export{u as StepperProvider,l as useStepper};
|
|
1
|
+
import{createContext as e,useCallback as t,useContext as n,useState as r}from"react";import{jsx as i}from"react/jsx-runtime";import{useLocation as a,useNavigate as o,useParams as s}from"@tanstack/react-router";const c=e(void 0);function l(){let e=n(c);if(!e)throw Error(`useStepper must be used within a StepperProvider`);return e}const u=({steps:e,children:n,isStepDisabled:l,...u})=>{let{step:d}=s({strict:!1}),f=o(),p=a().pathname.split(`/`).slice(0,-1).join(`/`),m=u.syncToURLParam?Number(d):u?.initialStep??0;if(u.syncToURLParam&&d&&isNaN(Number(d)))throw Error(`Step URL param must be a valid number when using "syncToURLParam"`);if(e.length<2)throw Error(`Stepper must have at least 2 steps`);let[h,g]=r(m),_=u.syncToURLParam?Number(d):h,[v,y]=r(0);if(m>=e.length||m<0)throw Error(`initialStep must be a valid index of the steps array`);let b=t=>{if(t===_)return;if(t>_){v!==0&&y(0);return}let n=e.at(t);if(n&&`subSteps`in n&&n.subSteps&&n.subSteps.length>0){y(n.subSteps.length-1);return}v!==0&&y(0)},x=e=>{b(e),u.syncToURLParam?f({to:`${p}/${e}`}):g(e)},S=()=>{if(`subSteps`in e[_]&&e[_].subSteps&&v<e[_].subSteps.length-1){y(e=>e+1);return}_!==e.length-1&&x(_+1)},C=()=>{if(v>0&&`subSteps`in e[_]&&e[_].subSteps&&e[_].subSteps.length>0){y(e=>e-1);return}_!==0&&x(_-1)},w=t(t=>l?l({step:e[t],stepIndex:t,currentStep:e[_],currentStepIndex:_}):!1,[l,_,e]);return i(c.Provider,{value:{steps:e,currentStep:_,currentSubStep:v,setCurrentStep:x,goToNextStep:S,goToPreviousStep:C,isStepAtIndexDisabled:w},children:n})};export{c as StepperContext,u as StepperProvider,l as useStepper};
|
|
@@ -26,4 +26,4 @@ interface TableOfContentsProviderProps {
|
|
|
26
26
|
}
|
|
27
27
|
declare const TableOfContentsProvider: FC<TableOfContentsProviderProps>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { TableOfContentsItemType, TableOfContentsProvider, useTableOfContents };
|
|
29
|
+
export { TableOfContentsItemType, TableOfContentsProvider, TableOfContentsProviderProps, useTableOfContents };
|
|
@@ -21,4 +21,4 @@ import{spacings as e}from"../../atoms/style/spacings.js";import{getHighlightElem
|
|
|
21
21
|
height: 100vh;
|
|
22
22
|
background: none;
|
|
23
23
|
pointer-events: none;
|
|
24
|
-
`,g=({children:e,contentRef:s})=>{let{activeTutorial:g,activeStep:_,unseenTutorialsOnThisPage:v}=f(),y=p()>0,b=n(s),[x,S]=o({width:window.innerWidth,height:window.innerHeight});a(()=>{let e=()=>{S({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[C,w]=o([]);a(()=>{y||(async()=>{if(g&&_!==void 0){if(!g.steps[_].highlightElement)return w([]);let e=await t(g.id,_,x);return w(e?[e]:[])}
|
|
24
|
+
`,g=({children:e,contentRef:s})=>{let{activeTutorial:g,activeStep:_,unseenTutorialsOnThisPage:v}=f(),y=p()>0,b=n(s),[x,S]=o({width:window.innerWidth,height:window.innerHeight});a(()=>{let e=()=>{S({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[C,w]=o([]);a(()=>{y||(async()=>{if(g&&_!==void 0){if(!g.steps[_].highlightElement)return w([]);let e=await t(g.id,_,x);return w(e?[e]:[])}let e=await Promise.all(v.map(e=>{if(e.steps.at(0)?.highlightElement)return t(e.id,0,x)}));return w(e.filter(e=>e!==void 0))})()},[_,g,y,v,x]);let T=g?[g]:v.filter(e=>e.steps[0].highlightElement&&C.some(e=>e.id)||!e.steps[0].highlightElement);return T.length>0?u(c,{children:[e,l(h,{children:T.map(e=>{let t=C.find(t=>t.id===e.id);return l(i,{isHighlighting:C.length>0,contentRef:s,...e,...t},e.id)})}),u(m,{children:[u(`mask`,{id:`tutorials-rectangles`,children:[l(`rect`,{width:`100%`,height:`100%`,fill:`white`}),l(d.g,{style:{translateY:b},children:C.map(e=>l(d.path,{"data-testid":`tutorial-mask-${e.id}`,initial:{opacity:0,d:`M ${e.left} ${e.top} h ${e.width} v ${e.height} h -${e.width} Z`},animate:{opacity:1,d:`M ${e.left} ${e.top} h ${e.width} v ${e.height} h -${e.width} Z`},fill:`black`},e.id))})]}),l(d.rect,{width:`100%`,height:`100%`,fill:`rgba(111, 111, 111, 0.35)`,mask:`url(#tutorials-rectangles)`,...r})]})]}):l(c,{children:e})};export{g as TutorialHighlightingProviderInner};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/amplify-component-lib",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.5-beta.1",
|
|
4
4
|
"description": "Frontend Typescript components for the Amplify team",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"@equinor/subsurface-app-management": "5.4.7",
|
|
58
58
|
"@eslint/js": "^9.22.0",
|
|
59
59
|
"@faker-js/faker": "^9.6.0",
|
|
60
|
-
"@storybook/addon-coverage": "^
|
|
61
|
-
"@storybook/addon-designs": "^
|
|
62
|
-
"@storybook/addon-docs": "^
|
|
63
|
-
"@storybook/addon-links": "^
|
|
64
|
-
"@storybook/addon-vitest": "^
|
|
65
|
-
"@storybook/react-vite": "^
|
|
60
|
+
"@storybook/addon-coverage": "^3.0.1",
|
|
61
|
+
"@storybook/addon-designs": "^11.1.3",
|
|
62
|
+
"@storybook/addon-docs": "^10.4.6",
|
|
63
|
+
"@storybook/addon-links": "^10.4.6",
|
|
64
|
+
"@storybook/addon-vitest": "^10.4.6",
|
|
65
|
+
"@storybook/react-vite": "^10.4.6",
|
|
66
66
|
"@tanstack/react-query": "^5.67.2",
|
|
67
67
|
"@testing-library/dom": "^10.4.0",
|
|
68
68
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"eslint-plugin-react": "^7.37.4",
|
|
87
87
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
88
88
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
89
|
-
"eslint-plugin-storybook": "^
|
|
89
|
+
"eslint-plugin-storybook": "^10.4.6",
|
|
90
90
|
"jest-environment-jsdom": "^29.7.0",
|
|
91
91
|
"jest-styled-components": "^7.2.0",
|
|
92
92
|
"msw": "^2.13.3",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"react-dom": "^19.0.0",
|
|
99
99
|
"resize-observer-polyfill": "^1.5.1",
|
|
100
100
|
"resolve-tspaths": "^0.8.23",
|
|
101
|
-
"storybook": "^
|
|
101
|
+
"storybook": "^10.4.6",
|
|
102
102
|
"tsdown": "^0.14.2",
|
|
103
103
|
"typescript": "^6.0.2",
|
|
104
104
|
"typescript-eslint": "^8.58.2",
|