@equinor/subsurface-app-management 3.1.7 → 4.0.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 (31) hide show
  1. package/dist/api/core/OpenAPI.d.ts +1 -7
  2. package/dist/api/core/OpenAPI.js +1 -1
  3. package/dist/api/index.d.ts +1 -1
  4. package/dist/api/services/TutorialService.d.ts +1 -14
  5. package/dist/api/services/TutorialService.js +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/providers/index.d.ts +0 -2
  8. package/dist/tests/setupTests.d.ts +0 -1
  9. package/package.json +3 -9
  10. package/dist/node_modules/@equinor/eds-tokens/dist/esm/base/colors.js +0 -1
  11. package/dist/node_modules/@equinor/eds-tokens/dist/esm/base/elevation.js +0 -1
  12. package/dist/node_modules/@equinor/eds-tokens/dist/esm/base/index.js +0 -1
  13. package/dist/node_modules/@equinor/eds-tokens/dist/esm/base/shape.js +0 -1
  14. package/dist/node_modules/@equinor/eds-tokens/dist/esm/base/spacings.js +0 -1
  15. package/dist/providers/OldTutorialProvider/OldTutorialDialog.d.ts +0 -6
  16. package/dist/providers/OldTutorialProvider/OldTutorialDialog.js +0 -1
  17. package/dist/providers/OldTutorialProvider/OldTutorialProvider.const.d.ts +0 -5
  18. package/dist/providers/OldTutorialProvider/OldTutorialProvider.const.js +0 -1
  19. package/dist/providers/OldTutorialProvider/OldTutorialProvider.d.ts +0 -47
  20. package/dist/providers/OldTutorialProvider/OldTutorialProvider.hooks.d.ts +0 -9
  21. package/dist/providers/OldTutorialProvider/OldTutorialProvider.hooks.js +0 -1
  22. package/dist/providers/OldTutorialProvider/OldTutorialProvider.js +0 -1
  23. package/dist/providers/OldTutorialProvider/OldTutorialProvider.styles.d.ts +0 -27
  24. package/dist/providers/OldTutorialProvider/OldTutorialProvider.styles.js +0 -68
  25. package/dist/providers/OldTutorialProvider/OldTutorialProvider.types.d.ts +0 -11
  26. package/dist/providers/OldTutorialProvider/OldTutorialProvider.utils.d.ts +0 -3
  27. package/dist/providers/OldTutorialProvider/OldTutorialProvider.utils.js +0 -1
  28. package/dist/providers/OldTutorialProvider/OldTutorialProviderInner.d.ts +0 -3
  29. package/dist/providers/OldTutorialProvider/OldTutorialProviderInner.js +0 -1
  30. package/dist/providers/OldTutorialProvider/OldTutorialStepIndicator.d.ts +0 -8
  31. package/dist/providers/OldTutorialProvider/OldTutorialStepIndicator.js +0 -25
@@ -15,15 +15,11 @@ export type OpenAPIConfig = {
15
15
  };
16
16
  export declare class TokenService {
17
17
  /**
18
+ * @deprecated
18
19
  * @returns string Success
19
20
  * @throws ApiError
20
21
  */
21
22
  static getAmplifyPortalToken(): CancelablePromise<string>;
22
- /**
23
- * @returns string Success
24
- * @throws ApiError
25
- */
26
- static getAmplifyPortalProductionToken(): CancelablePromise<string>;
27
23
  /**
28
24
  * @returns string Success
29
25
  * @throws ApiError
@@ -42,8 +38,6 @@ export declare const getJSEmbarkToken: () => Promise<string>;
42
38
  export declare const getPortalToken: () => Promise<string>;
43
39
  export declare const getSAMToken: () => Promise<string>;
44
40
  export declare const OpenAPI_APP: OpenAPIConfig;
45
- export declare const OpenAPI_JSEMBARK: OpenAPIConfig;
46
- export declare const OpenAPI_JSEMBARK_Prod: OpenAPIConfig;
47
41
  export declare const OpenAPI_SAM: OpenAPIConfig;
48
42
  export declare const OpenAPI_SAM_Prod: OpenAPIConfig;
49
43
  export {};
@@ -1 +1 @@
1
- import*as o from"../../utils/environment.js";import{request as t}from"./request.js";import{getLocalStorage as i,updateLocalStorage as r}from"../../utils/localStorage.js";import{jwtDecode as e}from"jwt-decode";const{getEnvironmentName:n,getApiUrl:E}=o,a=n(import.meta.env.VITE_ENVIRONMENT_NAME),d="localhost"===a?"development":a;class m{static getAmplifyPortalToken(){return t(A,{method:"GET",url:"/api/v1/Token/AmplifyPortal"})}static getAmplifyPortalProductionToken(){return t(A,{method:"GET",url:"/api/v1/Token/AmplifyPortal/Production"})}static getSamPortalToken(){return t(A,{method:"GET",url:"/api/v1/Token/SamPortal"})}static getSamPortalProductionToken(){return t(A,{method:"GET",url:"/api/v1/Token/SamPortal/Production"})}}const l=o=>{if(0===o.length)return!1;try{return!(o=>{const t=e(o),i=(new Date).getTime()/1e3;return t.exp&&i>t.exp})(o)}catch(o){return!1}},T=async(o,t)=>{const e=i(o,"");if(l(e))return e;const n=await t();return r(o,n),n},c=async()=>T(`amplify-portal-${a}`,m.getAmplifyPortalToken),S=()=>c(),p=async()=>T(`sam-${a}`,m.getSamPortalToken),A={BASE:E(import.meta.env.VITE_API_URL),VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},u={BASE:"https://api-amplify-portal-production.radix.equinor.com",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:async()=>T("amplify-portal-production",m.getAmplifyPortalProductionToken),USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},s={BASE:`https://api-sam-backend-${d}.radix.equinor.com`,VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:p,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},N={BASE:"https://api-sam-backend-production.radix.equinor.com",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:async()=>T("sam-production",m.getSamPortalProductionToken),USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};export{A as OpenAPI_APP,u as OpenAPI_JSEMBARK_Prod,s as OpenAPI_SAM,N as OpenAPI_SAM_Prod,m as TokenService,c as getJSEmbarkToken,S as getPortalToken,p as getSAMToken};
1
+ import*as t from"../../utils/environment.js";import{request as o}from"./request.js";import{getLocalStorage as e,updateLocalStorage as r}from"../../utils/localStorage.js";import{jwtDecode as i}from"jwt-decode";const{getEnvironmentName:n,getApiUrl:a}=t,E=n(import.meta.env.VITE_ENVIRONMENT_NAME),m="localhost"===E?"development":E;class d{static getAmplifyPortalToken(){return o(A,{method:"GET",url:"/api/v1/Token/AmplifyPortal"})}static getSamPortalToken(){return o(A,{method:"GET",url:"/api/v1/Token/SamPortal"})}static getSamPortalProductionToken(){return o(A,{method:"GET",url:"/api/v1/Token/SamPortal/Production"})}}const S=t=>{if(0===t.length)return!1;try{return!(t=>{const o=i(t),e=(new Date).getTime()/1e3;return o.exp&&e>o.exp})(t)}catch(t){return!1}},T=async(t,o)=>{const i=e(t,"");if(S(i))return i;const n=await o();return r(t,n),n},c=async()=>T(`amplify-portal-${E}`,d.getAmplifyPortalToken),l=()=>c(),s=async()=>T(`sam-${E}`,d.getSamPortalToken),A={BASE:a(import.meta.env.VITE_API_URL),VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},p={BASE:`https://api-sam-backend-${m}.radix.equinor.com`,VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:s,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},u={BASE:"https://api-sam-backend-production.radix.equinor.com",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:async()=>T("sam-production",d.getSamPortalProductionToken),USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};export{A as OpenAPI_APP,p as OpenAPI_SAM,u as OpenAPI_SAM_Prod,d as TokenService,c as getJSEmbarkToken,l as getPortalToken,s as getSAMToken};
@@ -1,6 +1,6 @@
1
1
  export { ApiError } from './core/ApiError';
2
2
  export { CancelablePromise, CancelError } from './core/CancelablePromise';
3
- export { OpenAPI_APP, getJSEmbarkToken, getSAMToken, getPortalToken, } from './core/OpenAPI';
3
+ export { OpenAPI_APP, getSAMToken, getJSEmbarkToken, getPortalToken, } from './core/OpenAPI';
4
4
  export { request } from './core/request';
5
5
  export type { OpenAPIConfig } from './core/OpenAPI';
6
6
  export type { AmplifyApplication } from './models/AmplifyApplication';
@@ -1,19 +1,6 @@
1
- import { CancelablePromise, Tutorial } from './..';
1
+ import { CancelablePromise } from './..';
2
2
  import { MyTutorialDto } from '../models/MyTutorialDto';
3
3
  export declare class TutorialService {
4
- /**
5
- * Gets all tutorials for Application
6
- * @param applicationName
7
- * @returns Tutorial Success
8
- * @throws ApiError
9
- */
10
- static getTutorialsForApplication(applicationName: string): CancelablePromise<Array<Tutorial>>;
11
- /**
12
- * Get A SAS token for Tutorial image container
13
- * @returns string Success
14
- * @throws ApiError
15
- */
16
- static getTutorialSasToken(): CancelablePromise<string>;
17
4
  /**
18
5
  * Gets My tutorials filtered on my Roles and Groups
19
6
  * @param applicationName
@@ -1 +1 @@
1
- import{OpenAPI_JSEMBARK_Prod as t,OpenAPI_SAM_Prod as a}from"../core/OpenAPI.js";import{request as r}from"../core/request.js";class i{static getTutorialsForApplication(a){return r(t,{method:"GET",url:"/api/v1/Tutorial/{applicationName}",path:{applicationName:a}})}static getTutorialSasToken(){return r(t,{method:"GET",url:"/api/v1/Tutorial/SASToken"})}static getMyTutorialsForApplication(t,i=!0){return r(a,{method:"GET",url:"/api/v1/Tutorial/me/{includeDrafts}",path:{includeDrafts:i},query:{applicationName:t}})}static getDraftTutorialsForApplication(t){return r(a,{method:"GET",url:"/api/v1/Tutorial/draft/{applicationName}",path:{applicationName:t}})}static getTutorialImage(t){return r(a,{method:"GET",url:"/api/v1/Tutorial/gettutorialimage/{path}",path:{path:t},errors:{404:"Not Found"}})}}export{i as TutorialService};
1
+ import{OpenAPI_SAM_Prod as t}from"../core/OpenAPI.js";import{request as a}from"../core/request.js";class r{static getMyTutorialsForApplication(r,i=!0){return a(t,{method:"GET",url:"/api/v1/Tutorial/me/{includeDrafts}",path:{includeDrafts:i},query:{applicationName:r}})}static getDraftTutorialsForApplication(r){return a(t,{method:"GET",url:"/api/v1/Tutorial/draft/{applicationName}",path:{applicationName:r}})}static getTutorialImage(r){return a(t,{method:"GET",url:"/api/v1/Tutorial/gettutorialimage/{path}",path:{path:r},errors:{404:"Not Found"}})}}export{r as TutorialService};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{Feature}from"./components/Feature/Feature.js";export{FeatureRoute}from"./components/FeatureRoute/FeatureRoute.js";export{FeatureToggleProvider,useFeatureToggleContext}from"./providers/FeatureToggleProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{useTutorialsQuery}from"./hooks/useTutorialsQuery.js";export{useTutorialStepImage}from"./hooks/useTutorialStepImage.js";export{OldTutorialProvider}from"./providers/OldTutorialProvider/OldTutorialProvider.js";export{useOldTutorial}from"./providers/OldTutorialProvider/OldTutorialProvider.hooks.js";export{TutorialProvider,useTutorials}from"./providers/TutorialProvider/TutorialProvider.js";export{ApplicationInsightsProvider}from"./providers/ApplicationInsightsProvider.js";export{EnvironmentType}from"./types/Environment.js";export{RELEASENOTE_TYPES_INFORMATION,ReleaseNoteType}from"./types/ReleaseNotes.js";import*as e from"./utils/environment.js";export{e as environment};export{ApiError}from"./api/core/ApiError.js";export{CancelError,CancelablePromise}from"./api/core/CancelablePromise.js";export{OpenAPI_APP,getJSEmbarkToken,getPortalToken,getSAMToken}from"./api/core/OpenAPI.js";export{request}from"./api/core/request.js";export{ApplicationCategory}from"./api/models/ApplicationCategory.js";export{ServiceNowUrgency}from"./api/models/ServiceNowUrgency.js";export{TutorialPosition}from"./api/models/TutorialPosition.js";export{AmplifyApplicationService}from"./api/services/AmplifyApplicationService.js";export{FeatureToggleService}from"./api/services/FeatureToggleService.js";export{ImpersonateUserService}from"./api/services/ImpersonateUserService.js";export{ReleaseNotesService}from"./api/services/ReleaseNotesService.js";export{ServiceNowService}from"./api/services/ServiceNowService.js";export{SlackService}from"./api/services/SlackService.js";export{TutorialService}from"./api/services/TutorialService.js";export{GET_FEATURE_TOGGLES_FOR_APP,GET_RELEASE_NOTES,GET_TUTORIALS_FOR_APP,GET_TUTORIALS_SAS_TOKEN,GET_TUTORIAL_STEP_IMAGE,SAM_QUERIES}from"./constants/queryKeys.js";
1
+ export{Feature}from"./components/Feature/Feature.js";export{FeatureRoute}from"./components/FeatureRoute/FeatureRoute.js";export{FeatureToggleProvider,useFeatureToggleContext}from"./providers/FeatureToggleProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{useTutorialsQuery}from"./hooks/useTutorialsQuery.js";export{useTutorialStepImage}from"./hooks/useTutorialStepImage.js";export{TutorialProvider,useTutorials}from"./providers/TutorialProvider/TutorialProvider.js";export{ApplicationInsightsProvider}from"./providers/ApplicationInsightsProvider.js";export{EnvironmentType}from"./types/Environment.js";export{RELEASENOTE_TYPES_INFORMATION,ReleaseNoteType}from"./types/ReleaseNotes.js";import*as e from"./utils/environment.js";export{e as environment};export{ApiError}from"./api/core/ApiError.js";export{CancelError,CancelablePromise}from"./api/core/CancelablePromise.js";export{OpenAPI_APP,getJSEmbarkToken,getPortalToken,getSAMToken}from"./api/core/OpenAPI.js";export{request}from"./api/core/request.js";export{ApplicationCategory}from"./api/models/ApplicationCategory.js";export{ServiceNowUrgency}from"./api/models/ServiceNowUrgency.js";export{TutorialPosition}from"./api/models/TutorialPosition.js";export{AmplifyApplicationService}from"./api/services/AmplifyApplicationService.js";export{FeatureToggleService}from"./api/services/FeatureToggleService.js";export{ImpersonateUserService}from"./api/services/ImpersonateUserService.js";export{ReleaseNotesService}from"./api/services/ReleaseNotesService.js";export{ServiceNowService}from"./api/services/ServiceNowService.js";export{SlackService}from"./api/services/SlackService.js";export{TutorialService}from"./api/services/TutorialService.js";export{GET_FEATURE_TOGGLES_FOR_APP,GET_RELEASE_NOTES,GET_TUTORIALS_FOR_APP,GET_TUTORIALS_SAS_TOKEN,GET_TUTORIAL_STEP_IMAGE,SAM_QUERIES}from"./constants/queryKeys.js";
@@ -1,5 +1,3 @@
1
- export { OldTutorialProvider } from './OldTutorialProvider/OldTutorialProvider';
2
1
  export { FeatureToggleProvider } from './FeatureToggleProvider';
3
- export { useOldTutorial } from './OldTutorialProvider/OldTutorialProvider.hooks';
4
2
  export { TutorialProvider, useTutorials, } from './TutorialProvider/TutorialProvider';
5
3
  export { ApplicationInsightsProvider } from './ApplicationInsightsProvider';
@@ -1,2 +1 @@
1
1
  import '@testing-library/jest-dom';
2
- import 'jest-styled-components';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "3.1.7",
3
+ "version": "4.0.1",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -48,6 +48,7 @@
48
48
  ]
49
49
  },
50
50
  "devDependencies": {
51
+ "@equinor/eds-core-react": "^0.44.0",
51
52
  "@faker-js/faker": "^9.3.0",
52
53
  "@rollup/plugin-commonjs": "^28.0.2",
53
54
  "@rollup/plugin-node-resolve": "^16.0.0",
@@ -69,12 +70,10 @@
69
70
  "@testing-library/react": "^16.1.0",
70
71
  "@testing-library/user-event": "^14.5.2",
71
72
  "@types/lodash-es": "^4.17.12",
72
- "@types/mocha": "^10.0.10",
73
73
  "@types/node": "^22.10.2",
74
74
  "@types/react": "^19.0.1",
75
75
  "@types/react-dom": "^19.0.2",
76
76
  "@types/react-router-dom": "^5.3.3",
77
- "@types/styled-components": "^5.1.34",
78
77
  "@vitejs/plugin-react": "^4.3.4",
79
78
  "@vitest/coverage-v8": "^2.1.8",
80
79
  "eslint": "^9.17.0",
@@ -82,7 +81,6 @@
82
81
  "eslint-plugin-react-hooks": "^5.1.0",
83
82
  "eslint-plugin-simple-import-sort": "^12.1.1",
84
83
  "eslint-plugin-storybook": "^0.11.1",
85
- "jest-styled-components": "^7.2.0",
86
84
  "jsdom": "^25.0.1",
87
85
  "lint-staged": "^15.2.11",
88
86
  "ora": "^8.1.1",
@@ -105,15 +103,11 @@
105
103
  "vitest": "^2.1.8"
106
104
  },
107
105
  "peerDependencies": {
108
- "@equinor/eds-core-react": "*",
109
- "@equinor/eds-icons": "*",
110
106
  "@tanstack/react-query": "*",
111
- "framer-motion": "*",
112
107
  "react": "^19.0.0",
113
108
  "react-dom": "^19.0.0",
114
109
  "react-router": "^6.11.1",
115
- "react-router-dom": "^6.11.1",
116
- "styled-components": "^6.1.8"
110
+ "react-router-dom": "^6.11.1"
117
111
  },
118
112
  "dependencies": {
119
113
  "@microsoft/applicationinsights-clickanalytics-js": "^3.3.6",
@@ -1 +0,0 @@
1
- var r={interactive:{primary__resting:{rgba:"var(--eds_interactive_primary__resting, rgba(0, 112, 121, 1))"},primary__hover_alt:{rgba:"var(--eds_interactive_primary__hover_alt, rgba(222, 237, 238, 1))"}}};export{r as colors};
@@ -1 +0,0 @@
1
- var p={above_scrim:"0 11px 15px rgba(0, 0, 0, 0.2),0 9px 46px rgba(0, 0, 0, 0.12),0 24px 38px rgba(0, 0, 0, 0.14)"};export{p as elevation};
@@ -1 +0,0 @@
1
- import{colors as o}from"./colors.js";import{elevation as r}from"./elevation.js";import{shape as s}from"./shape.js";import{spacings as p}from"./spacings.js";var i={colors:o,elevation:r,shape:s,spacings:p};export{i as tokens};
@@ -1 +0,0 @@
1
- var r={corners:{borderRadius:"4px"}};export{r as shape};
@@ -1 +0,0 @@
1
- var l={comfortable:{large:"24px",medium:"16px",medium_small:"12px",small:"8px",x_small:"4px"}};export{l as spacings};
@@ -1,6 +0,0 @@
1
- import { FC } from 'react';
2
- interface OldTutorialDialogProps {
3
- resetHasStartedTutorial: () => void;
4
- }
5
- declare const OldTutorialDialog: FC<OldTutorialDialogProps>;
6
- export default OldTutorialDialog;
@@ -1 +0,0 @@
1
- import{jsxs as t,Fragment as r,jsx as e}from"react/jsx-runtime";import{useMemo as i}from"react";import{Button as o}from"@equinor/eds-core-react";import{DIALOG_EDGE_MARGIN as a,TUTORIAL_LOCALSTORAGE_VALUE_STRING as n}from"./OldTutorialProvider.const.js";import{useGetTutorialSasToken as l,useOldTutorial as s}from"./OldTutorialProvider.hooks.js";import{DialogTypography as m,DialogImage as c,DialogWrapper as d,StyledTutorialDialog as p,DialogContent as u,DialogActions as g,NavigateSteps as h}from"./OldTutorialProvider.styles.js";import{getBestPositionWithoutOverlap as T}from"./OldTutorialProvider.utils.js";import f from"./OldTutorialStepIndicator.js";import"../../api/core/OpenAPI.js";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import{TutorialPosition as v}from"../../api/models/TutorialPosition.js";const O=({resetHasStartedTutorial:O})=>{const{data:y}=l(),{activeTutorial:P,currentStep:S,setCurrentStep:j,setActiveTutorial:x,dialogRef:k,allElementsToHighlight:$,customStepComponents:C,isLastStep:R,currentStepObject:B,setAllElementsToHighlight:E,shortNameFromParams:H,viewportWidth:I,clearSearchParam:_}=s(),w=i((()=>{if(B)return B.key&&C?C.find((t=>t.key===B.key))?.element:void 0===B.key||null===B.key?t(r,{children:[e(m,{variant:"h5",children:B.title}),e(m,{group:"paragraph",variant:"body_short",children:B.body}),B.imgUrl&&y&&e(c,{"data-testid":"tutorial-image",alt:"tutorial-image",src:`${B.imgUrl}?${y}`})]}):void 0}),[B,C,y]),L=i((()=>{if(P&&I&&$&&k.current)return P.steps[S].position?P.steps[S].position:P.dynamicPositioning?T($[S].getBoundingClientRect(),k.current.getBoundingClientRect()):v.BOTTOM_RIGHT}),[P,I,$,k,S]),N=i((()=>{if(L&&L!==v.CENTER)switch(L){case v.TOP_LEFT:return{marginTop:`${a}px`,marginLeft:`${a}px`};case v.TOP_RIGHT:return{marginTop:`${a}px`,marginRight:`${a}px`};case v.BOTTOM_LEFT:return{marginBottom:`${a}px`,marginLeft:`${a}px`};case v.BOTTOM_RIGHT:default:return{marginBottom:`${a}px`,marginRight:`${a}px`}}}),[L]),A=()=>{H&&_(),P&&(window.localStorage.setItem(P?.shortName,n),x(void 0),k.current?.close(),j(0),E(void 0),O())};return e(d,{children:e(p,{"data-testid":"tutorial-dialog",ref:k,style:N??void 0,children:t(u,{children:[w,e(f,{steps:P?.steps??[],currentStep:S}),t(g,{children:[e(o,{variant:"ghost",onClick:()=>{A()},children:"Skip"}),t(h,{children:[S&&0!==S?e(o,{variant:"ghost",onClick:()=>{j((t=>t-1))},children:"Previous"}):null,e(o,{variant:"outlined",onClick:()=>{R?A():j((t=>t+1))},children:R?"Done":"Next"})]})]})]})})})};export{O as default};
@@ -1,5 +0,0 @@
1
- export declare const HIGHLIGHT_PADDING = 8;
2
- export declare const DIALOG_EDGE_MARGIN = 24;
3
- export declare const TUTORIAL_SEARCH_PARAM_KEY = "tutorial";
4
- export declare const TUTORIAL_LOCALSTORAGE_VALUE_STRING = "hasCompletedTutorial";
5
- export declare const TUTORIAL_HIGHLIGHTER_DATATEST_ID = "tutorial-highlighter";
@@ -1 +0,0 @@
1
- const t=8,o=24,i="tutorial",l="hasCompletedTutorial",r="tutorial-highlighter";export{o as DIALOG_EDGE_MARGIN,t as HIGHLIGHT_PADDING,r as TUTORIAL_HIGHLIGHTER_DATATEST_ID,l as TUTORIAL_LOCALSTORAGE_VALUE_STRING,i as TUTORIAL_SEARCH_PARAM_KEY};
@@ -1,47 +0,0 @@
1
- import { Dispatch, FC, MutableRefObject, ReactNode, SetStateAction } from 'react';
2
- import { CustomTutorialComponent } from './OldTutorialProvider.types';
3
- import { Step, Tutorial } from '../../api';
4
- import { EnvironmentType } from '../../types';
5
- export interface TutorialContextType {
6
- activeTutorial: Tutorial | undefined;
7
- setActiveTutorial: Dispatch<SetStateAction<Tutorial | undefined>>;
8
- currentStep: number;
9
- setCurrentStep: Dispatch<SetStateAction<number>>;
10
- allElementsToHighlight: HTMLElement[] | undefined;
11
- setAllElementsToHighlight: Dispatch<SetStateAction<HTMLElement[] | undefined>>;
12
- customStepComponents: CustomTutorialComponent[] | undefined;
13
- currentStepObject: Step | undefined;
14
- isLastStep: boolean;
15
- dialogRef: MutableRefObject<HTMLDialogElement | null>;
16
- clearSearchParam: () => void;
17
- shortNameFromParams: string | undefined;
18
- setShortNameFromParams: Dispatch<SetStateAction<string | undefined>>;
19
- tutorialsFromProps: Tutorial[];
20
- tutorialError: boolean;
21
- setTutorialError: Dispatch<SetStateAction<boolean>>;
22
- viewportWidth: number;
23
- appName: string;
24
- environmentName: EnvironmentType;
25
- }
26
- export declare const TutorialContext: import("react").Context<TutorialContextType | undefined>;
27
- interface OldTutorialProviderProps {
28
- children: ReactNode;
29
- overrideAppName?: string;
30
- overrideEnvironmentName?: EnvironmentType;
31
- customStepComponents?: CustomTutorialComponent[];
32
- tutorials?: Tutorial[];
33
- ignoredQueryKeys?: string[];
34
- }
35
- /**
36
- * Tutorial provider expects to be within a QueryClientProvider
37
- * @deprecated - Use new TutorialProvider instead
38
- * @param children Expects to wrap the application globally, typically in a providers file with multiple providers
39
- * @param overrideAppName Overrides the "NAME" env variable, which is used to fetch the relevant tutorials for your app
40
- * @param overrideEnvironmentName Overrides the "ENVIRONMENT_NAME" env variable, which is used for the possibility to hide tutorials in "production"
41
- * @param customStepComponents Adds custom steps components with a key that can be used to link it to a step in a tutorial
42
- * @param tutorials Passing tutorial object directly. This does not replace any tutorials found from API call, but rather is appended to them
43
- * @param ignoredQueryKeys An array of query keys TutorialProviders will not wait to finish loading before looking for elements to highlight
44
- * @constructor
45
- */
46
- export declare const OldTutorialProvider: FC<OldTutorialProviderProps>;
47
- export {};
@@ -1,9 +0,0 @@
1
- import { Query } from '@tanstack/react-query';
2
- export declare const useGetTutorialsForApp: (appName: string) => import("@tanstack/react-query").UseQueryResult<import("../..").Tutorial[], Error>;
3
- export declare const useGetTutorialSasToken: () => import("@tanstack/react-query").UseQueryResult<string, Error>;
4
- /**
5
- * Use with caution. There has not been much testing of how using this hook in an app affects the tutorial logic
6
- * @deprecated - Use new Tutorial hook instead
7
- */
8
- export declare const useOldTutorial: () => import("./OldTutorialProvider").TutorialContextType;
9
- export declare const useIsFetchingWithTimeout: (predicateFn: (query: Query) => boolean) => boolean;
@@ -1 +0,0 @@
1
- import{useContext as r,useState as t,useEffect as e}from"react";import{useIsFetching as o,useQuery as i}from"@tanstack/react-query";import{TutorialService as u}from"../../api/services/TutorialService.js";import{GET_TUTORIALS_FOR_APP as s,GET_TUTORIALS_SAS_TOKEN as a}from"../../constants/queryKeys.js";import{TutorialContext as n}from"./OldTutorialProvider.js";const c=r=>i({queryKey:[s,r],queryFn:()=>u.getTutorialsForApplication(r)}),m=()=>i({queryKey:[a],queryFn:()=>u.getTutorialSasToken()}),p=()=>{const t=r(n);if(void 0===t)throw new Error("'useTutorial' must be used within a TutorialProvider");return t},l=r=>{const[i,u]=t(!0),s=o({predicate:r})>0;return e((()=>{const r=setTimeout((()=>{u(s)}),100);return()=>clearTimeout(r)}),[s]),i||i!==s};export{m as useGetTutorialSasToken,c as useGetTutorialsForApp,l as useIsFetchingWithTimeout,p as useOldTutorial};
@@ -1 +0,0 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{createContext as r,useState as o,useRef as i,useMemo as n,useCallback as s,useEffect as l}from"react";import{useSearchParams as m}from"react-router-dom";import{TUTORIAL_SEARCH_PARAM_KEY as a}from"./OldTutorialProvider.const.js";import{useIsFetchingWithTimeout as u}from"./OldTutorialProvider.hooks.js";import{getAllElementsToHighlight as d}from"./OldTutorialProvider.utils.js";import c from"./OldTutorialProviderInner.js";import{getAppName as p,getEnvironmentName as h}from"../../utils/environment.js";const v=r(void 0),f=({children:r,overrideAppName:f,overrideEnvironmentName:y,customStepComponents:g,tutorials:T,ignoredQueryKeys:E})=>{const[w,N]=o(void 0),[P,k]=o(!1),[S,j]=m(),[C,O]=o(void 0),[A,x]=o(0),[I,F]=o(void 0),[H,L]=o(window.innerWidth),M=u((e=>!E?.some((t=>e.queryKey.includes(t))))),V=i(null),W=f??p(import.meta.env.VITE_NAME),_=y??h(import.meta.env.VITE_ENVIRONMENT_NAME),z=n((()=>{if(w)return w.steps.at(A)}),[w,A]),K=n((()=>!!w&&A>=w?.steps.length-1),[w,A]),R=s((()=>{S.delete(a),j(S),O(void 0)}),[S,j]);return l((()=>{if(C)return;const e=S.get(a);e&&O(e)}),[S,C]),l((()=>{const e=()=>{L(window.innerWidth)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(!w||P||M)return;const e=d(w);e.every((e=>null!==e))?F(e):(async()=>{await new Promise((e=>setTimeout(e,300)));const e=d(w);e.every((e=>null!==e))?F(e):(console.error("Could not find all elements to highlight for the tutorial. \n This is a list of elements that were found for each step: ",e),k(!0))})().catch((e=>{console.error("Error trying to get elements to highlight",e)}))}),[w,A,P,C,M]),l((()=>{if(!w||P||M)return;const e=w.steps.filter((e=>void 0!==e.key&&null!==e.key)).map((e=>e.key));if(0===e.length)return;const t=g?.map((e=>e.key));if(!t||0===t.length)return console.error("Could not find any custom components passed to the TutorialProvider \nExpected these keys for the active tutorial: ",e),void k(!0);e.map((e=>e&&t?.includes(e))).some((e=>!0!==e))&&(console.error("Could not find the custom components related to the active tutorial. \n The active tutorial expected to find these keys: ",e,"\n However in the custom components we only found these keys: ",t),k(!0))}),[w,M,g,P]),e(v.Provider,{value:{currentStepObject:z,activeTutorial:w,setActiveTutorial:N,currentStep:A,setCurrentStep:x,allElementsToHighlight:I,setAllElementsToHighlight:F,customStepComponents:g,isLastStep:K,dialogRef:V,clearSearchParam:R,shortNameFromParams:C,setShortNameFromParams:O,tutorialsFromProps:T??[],tutorialError:P,setTutorialError:k,viewportWidth:H,appName:W,environmentName:_},children:[t(c,{}),r]})};export{f as OldTutorialProvider,v as TutorialContext};
@@ -1,27 +0,0 @@
1
- export declare const Highlighter: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const DialogWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const StyledTutorialDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, never>> & string;
4
- export declare const DialogContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
- export declare const DialogTypography: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<({
6
- as?: import("react").ElementType | undefined;
7
- } & (import("@equinor/eds-core-react").TypographyProps & Omit<any, "token" | "id" | "children" | "bold" | "link" | "style" | "slot" | "title" | "variant" | "group" | "italic" | "color" | "lines" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture">)) & import("styled-components/dist/types").BaseObject, import("styled-components/dist/types").BaseObject>> & string & Omit<import("@equinor/eds-utils").OverridableComponent<import("@equinor/eds-core-react").TypographyProps, HTMLElement>, keyof import("react").Component<any, {}, any>>;
8
- export declare const DialogImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
9
- export declare const DialogActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
10
- export declare const NavigateSteps: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
11
- export declare const TutorialErrorDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<{
12
- isDismissable?: boolean;
13
- open: boolean;
14
- onClose?: () => void;
15
- dialogRef?: import("react").ForwardedRef<HTMLDialogElement>;
16
- } & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<{
17
- isDismissable?: boolean;
18
- open: boolean;
19
- onClose?: () => void;
20
- dialogRef?: import("react").ForwardedRef<HTMLDialogElement>;
21
- } & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>> & {
22
- Actions: typeof import("@equinor/eds-core-react").DialogActions;
23
- Title: typeof import("@equinor/eds-core-react").DialogTitle;
24
- CustomContent: typeof import("@equinor/eds-core-react").DialogContent;
25
- Content: typeof import("@equinor/eds-core-react").DialogContent;
26
- Header: typeof import("@equinor/eds-core-react").DialogHeader;
27
- }, keyof import("react").Component<any, {}, any>>;
@@ -1,68 +0,0 @@
1
- import{Typography as o,Dialog as i}from"@equinor/eds-core-react";import{tokens as t}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import e,{keyframes as a}from"styled-components";const{elevation:n,shape:r,spacings:d}=t,s=a`
2
- from {
3
- box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0);
4
- }
5
- to {
6
- box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
7
- }
8
- `,m=e.div`
9
- position: absolute;
10
- z-index: 10000;
11
- pointer-events: none;
12
- transition: top, left, width, height;
13
- transition-duration: 300ms;
14
- border-radius: 4px;
15
- animation: ${s} 300ms;
16
- animation-fill-mode: forwards;
17
- `,p=e.div`
18
- position: absolute;
19
- right: 24px;
20
- bottom: 24px;
21
- background: transparent;
22
- `,l=a`
23
- from {
24
- opacity: 0;
25
- }
26
- to {
27
- opacity: 1;
28
- }
29
- `,c=e.dialog`
30
- border: none;
31
- box-shadow: ${n.above_scrim};
32
- border-radius: ${r.corners.borderRadius};
33
- transition: all;
34
- transition-duration: 300ms;
35
- animation: ${l} 300ms;
36
- animation-fill-mode: forwards;
37
- &::backdrop {
38
- background: transparent;
39
- }
40
- `,f=e.div`
41
- display: flex;
42
- flex-direction: column;
43
- gap: ${d.comfortable.large};
44
- width: fit-content;
45
- `,x=e(o)`
46
- width: 300px;
47
- `,b=e.img`
48
- max-height: 300px;
49
- min-height: 50px;
50
- max-width: 300px;
51
- object-fit: contain;
52
- `,g=e.div`
53
- display: flex;
54
- justify-content: space-between;
55
- `,h=e.div`
56
- display: flex;
57
- gap: ${d.comfortable.medium};
58
- `,u=e(i)`
59
- width: 300px;
60
- height: fit-content;
61
- display: flex;
62
- flex-direction: column;
63
- padding: ${d.comfortable.medium};
64
- gap: ${d.comfortable.large};
65
- button {
66
- align-self: flex-end;
67
- }
68
- `;export{g as DialogActions,f as DialogContent,b as DialogImage,x as DialogTypography,p as DialogWrapper,m as Highlighter,h as NavigateSteps,c as StyledTutorialDialog,u as TutorialErrorDialog};
@@ -1,11 +0,0 @@
1
- import { ReactElement } from 'react';
2
- export interface HighlightingInfo {
3
- top: number;
4
- left: number;
5
- width: number;
6
- height: number;
7
- }
8
- export interface CustomTutorialComponent {
9
- key: string;
10
- element: ReactElement;
11
- }
@@ -1,3 +0,0 @@
1
- import { Tutorial, TutorialPosition } from '../../api';
2
- export declare const getBestPositionWithoutOverlap: (highlightedBoundingRect: DOMRect, dialogBoundingRect: DOMRect) => TutorialPosition.TOP_LEFT | TutorialPosition.TOP_RIGHT | TutorialPosition.BOTTOM_LEFT | TutorialPosition.BOTTOM_RIGHT;
3
- export declare const getAllElementsToHighlight: (activeTutorial: Tutorial) => (HTMLElement | null)[];
@@ -1 +0,0 @@
1
- import{DIALOG_EDGE_MARGIN as t}from"./OldTutorialProvider.const.js";import"../../api/core/OpenAPI.js";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import{TutorialPosition as T}from"../../api/models/TutorialPosition.js";const o=(t,T)=>!(t.top>T.bottom||t.bottom<T.top||t.right<T.left||t.left>T.right),e=(o,e)=>{const i=e===T.BOTTOM_RIGHT||e===T.BOTTOM_LEFT,O=e===T.TOP_RIGHT||e===T.BOTTOM_RIGHT,r=innerWidth-t-o.width,p=innerHeight-t-o.height;return new DOMRect(O?r:t,i?p:t,o.width,o.height)},i=(t,i)=>o(t,e(i,T.BOTTOM_RIGHT))?o(t,e(i,T.BOTTOM_LEFT))?o(t,e(i,T.TOP_RIGHT))?o(t,e(i,T.TOP_LEFT))?T.BOTTOM_RIGHT:T.TOP_LEFT:T.TOP_RIGHT:T.BOTTOM_LEFT:T.BOTTOM_RIGHT,O=t=>t.steps.map(((T,o)=>document.getElementById(`${t.shortName}-${o}`)));export{O as getAllElementsToHighlight,i as getBestPositionWithoutOverlap};
@@ -1,3 +0,0 @@
1
- import { FC } from 'react';
2
- declare const OldTutorialProviderInner: FC;
3
- export default OldTutorialProviderInner;
@@ -1 +0,0 @@
1
- import{jsxs as t,jsx as r,Fragment as e}from"react/jsx-runtime";import{useRef as o,useMemo as i,useCallback as l,useEffect as n}from"react";import{useLocation as a}from"react-router";import{Typography as s,Button as h}from"@equinor/eds-core-react";import{HIGHLIGHT_PADDING as p,TUTORIAL_HIGHLIGHTER_DATATEST_ID as c}from"./OldTutorialProvider.const.js";import{useOldTutorial as m,useGetTutorialsForApp as u}from"./OldTutorialProvider.hooks.js";import{TutorialErrorDialog as d,Highlighter as f}from"./OldTutorialProvider.styles.js";import g from"./OldTutorialDialog.js";import{EnvironmentType as w}from"../../types/Environment.js";const T=()=>{const{pathname:T}=a(),{activeTutorial:v,setActiveTutorial:P,dialogRef:j,allElementsToHighlight:x,shortNameFromParams:N,tutorialError:O,tutorialsFromProps:b,currentStep:C,viewportWidth:k,setTutorialError:E,clearSearchParam:I,appName:S,environmentName:$}=m(),y=o(!1),{data:D}=u(S),R=i((()=>{if(!(D||b&&0!==b.length))return[];const t=[];return b&&t.push(...b),D&&t.push(...D),t}),[D,b]),U=i((()=>{if(!x||!v||!k)return;const t=x[C],r=t.getBoundingClientRect();return t&&t.scrollIntoView({behavior:"smooth",block:"center"}),{top:r.top-p+window.scrollY,left:r.left-p,height:r.height+2*p,width:r.width+2*p}}),[v,x,C,k]),B=i((()=>R.filter((t=>T.includes(t.path)))),[R,T]),F=l((t=>{y.current||(P(t),y.current=!0)}),[P]);n((()=>{U&&!j.current?.open&&j.current?.showModal()}),[j,U]),n((()=>{if(B.length<1)return;const t=B.find((t=>t.shortName===N)),r=B.find((t=>!window.localStorage.getItem(t.shortName)&&t.willPopUp));t?F(t):r&&F(r)}),[F,N,B]);const H=()=>{I(),E(!1),P(void 0)},q=l((()=>{y.current=!1}),[]);return(v?.showInProd||$!==w.PRODUCTION)&&(v?.willPopUp||N)?O&&N?t(d,{open:!0,isDismissable:!0,onClose:H,children:[r(s,{children:"There was a problem starting this tutorial. Please report this in using the feedback function in the Top Bar."}),r(h,{variant:"outlined",onClick:H,children:"Close"})]}):O?null:t(e,{children:[U&&r(f,{"data-testid":c,style:{top:`${U.top}px`,left:`${U.left}px`,width:`${U.width}px`,height:`${U.height}px`}}),r(g,{resetHasStartedTutorial:q})]}):null};export{T as default};
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- import { Step } from '../../api';
3
- interface OldTutorialStepIndicatorProps {
4
- steps: Step[];
5
- currentStep: number;
6
- }
7
- declare const OldTutorialStepIndicator: FC<OldTutorialStepIndicatorProps>;
8
- export default OldTutorialStepIndicator;
@@ -1,25 +0,0 @@
1
- import{jsx as t}from"react/jsx-runtime";import{tokens as e}from"../../node_modules/@equinor/eds-tokens/dist/esm/base/index.js";import r from"styled-components";const{spacings:i,colors:o}=e,a=r.div`
2
- position: relative;
3
- transform: translate(0, -65%);
4
- display: flex;
5
- gap: ${i.comfortable.small};
6
- margin-bottom: -${i.comfortable.small};
7
- margin-top: ${i.comfortable.medium_small};
8
- width: 100%;
9
- justify-content: center;
10
- `,m=r.div`
11
- width: ${i.comfortable.medium};
12
- height: ${i.comfortable.x_small};
13
- border-radius: 24px;
14
- transition: all 300ms;
15
- background: linear-gradient(
16
- 90deg,
17
- ${o.interactive.primary__resting.rgba} 49%,
18
- ${o.interactive.primary__hover_alt.rgba} 51%
19
- );
20
-
21
- background-size:
22
- 400% 10px,
23
- 400%;
24
- ${t=>t.$active?"background-position: 0%":`background-position: ${t.$num<t.$activeNum?"-50":"100"}%`}
25
- `,n=({steps:e,currentStep:r})=>t(a,{children:e.map(((e,i)=>t(m,{$active:i===r,$activeNum:r,$num:i},e.key??e.title)))});export{n as default};