@availity/mui-spaces 1.0.22 → 1.0.24

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.24](https://github.com/Availity/element/compare/@availity/mui-spaces@1.0.23...@availity/mui-spaces@1.0.24) (2025-06-11)
6
+
7
+ ## [1.0.23](https://github.com/Availity/element/compare/@availity/mui-spaces@1.0.22...@availity/mui-spaces@1.0.23) (2025-06-10)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **mui-spaces:** don't check for sso type on rendered apps for sso linkout ([3bda63f](https://github.com/Availity/element/commit/3bda63f80fea1c6cdb7526fe905dd2b6bfbc1ffe))
13
+ * **mui-spaces:** put type back ([6aa9083](https://github.com/Availity/element/commit/6aa9083ff39fd3b384002f4e6951de80627b4c35))
14
+
5
15
  ## [1.0.22](https://github.com/Availity/element/compare/@availity/mui-spaces@1.0.21...@availity/mui-spaces@1.0.22) (2025-05-29)
6
16
 
7
17
  ### Dependency Updates
package/dist/index.d.mts CHANGED
@@ -1,110 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ElementType } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import { StatusChipProps } from '@availity/mui-chip';
4
5
  import { SvgIconProps } from '@mui/material';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
-
7
- type SpacesLinkVariants = 'card' | 'list' | 'default' | undefined;
8
- type SpacesLinkWithSpace = {
9
- /** If no spaceId is provided, the first space in the spaces array is used.
10
- * Note: This is only to be used when the Spaces provider should only ever contain a single space.
11
- */
12
- spaceId?: string;
13
- /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
14
- * This component does not have to be a child of SpacesProvider.
15
- * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
16
- */
17
- space: Space | SsoTypeSpace;
18
- } & SpacesLinkProps;
19
- type SpacesLinkWithSpaceId = {
20
- /** If no spaceId is provided, the first space in the spaces array is used.
21
- * Note: This is only to be used when the Spaces provider should only ever contain a single space.
22
- */
23
- spaceId: string;
24
- /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
25
- * This component does not have to be a child of SpacesProvider.
26
- * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
27
- */
28
- space?: Space | SsoTypeSpace;
29
- } & SpacesLinkProps;
30
- type SpacesLinkProps = {
31
- /** Children can be a react child or render prop. */
32
- children?: JSX.Element | ((props: any | undefined) => JSX.Element);
33
- /** Tag to overwrite the root component rendered. */
34
- tag?: ElementType<any, keyof JSX.IntrinsicElements>;
35
- /** Tag to overwrite the body component that renders the title, description and data values.
36
- * It defaults to CardBody or div depending on the value of the variant prop.
37
- */
38
- bodyTag?: ElementType<any, keyof JSX.IntrinsicElements>;
39
- /** Tag to overwrite the title component. If variant prop is set to "card", defaults to CardTitle.
40
- * If variant is set to "list", defaults to ListItemHeading. Overwise, defaults to div.
41
- */
42
- titleTag?: ElementType<any, keyof JSX.IntrinsicElements>;
43
- /** Tag to overwrite the text component. If variant prop is set to "card", defaults to Card Text.
44
- * If variant is set to "list", defaults to ListItemText. Otherwise, defaults to div.
45
- */
46
- textTag?: ElementType<any, keyof JSX.IntrinsicElements>;
47
- titleClassName?: string;
48
- /** When true, utilizes the Card component for styling. */
49
- card?: boolean;
50
- /** When true, renders an @availity/mui-icon next to the title if present on the Space. */
51
- icon?: (props: SvgIconProps) => JSX.Element;
52
- /** When true, renders the Spaces description beneath the title. */
53
- description?: boolean;
54
- /** When passed in, provides predefined styles for the component.
55
- * @default 'default'
56
- */
57
- variant?: SpacesLinkVariants;
58
- /** When true, renders the FavoriteHeart component to the left of the Component.
59
- * Note, this does require you to have wrapped your component somewhere in the Favorites Provider.
60
- * This also requires the peerDependency @tanstack/react-query.
61
- */
62
- favorite?: boolean;
63
- /** When true, renders the tyitle, and allow for the description and date info to be added on.
64
- * @default true
65
- */
66
- body?: boolean;
67
- /** When true, renders the activeDate of the space. */
68
- showDate?: boolean;
69
- /** When true, renders the name of the space.
70
- * @default true
71
- */
72
- showName?: boolean;
73
- /** When true, renders a "New!" badge if the activeDate is less than 30 days old. */
74
- showNew?: boolean;
75
- /** When true, renders the component vertically. */
76
- stacked?: boolean;
77
- /** Optionally pass in your own landing state for the component if you are managing the state yourself. */
78
- loading?: boolean;
79
- /** Required when space is not provided, or space is provided and space contains an sso link. */
80
- clientId?: string;
81
- style?: object;
82
- className?: string;
83
- /** Allows the description length to be truncated. */
84
- maxDescriptionWidth?: string;
85
- /** Additional attributes you may want to tack onto the native-form when submitting a SAML sso.
86
- * i.e. spaceId or sourceApplicationId
87
- */
88
- linkAttributes?: object;
89
- /** Allows the role of the root component to be overwritten.
90
- * If variant prop is set to "list", defaults to "listitem".
91
- */
92
- role?: string;
93
- /** When Analytics props are passed inside the analytics props, they will be passed down to the click item.
94
- * For more information on Analytics props see: Autotrack Logged Events
95
- */
96
- analytics?: object;
97
- customBadgeText?: string;
98
- customBadgeColor?: StatusChipProps['color'];
99
- /** prefix for ids to prevent duplicates when the same config link is displayed on the page more than once
100
- * @default ''
101
- */
102
- idPrefix?: string;
103
- [key: string]: any;
104
- };
105
- interface SsoTypeSpace extends Space {
106
- type: 'saml' | 'openid';
107
- }
108
6
 
109
7
  type Link = {
110
8
  /** Contains a URL or URL Fragment that the hyperlink points to. */
@@ -163,7 +61,7 @@ type Space = {
163
61
  };
164
62
  type SpacesContextType = {
165
63
  /** Array of spaces to be passed into the Spaces provider. */
166
- spaces?: Map<string, Space | SsoTypeSpace>;
64
+ spaces?: Map<string, Space>;
167
65
  /** Array of spaces from previous page load. */
168
66
  previousSpacesMap?: Map<string, Space>;
169
67
  /** Array of spaces organized by configurationId. */
@@ -203,7 +101,7 @@ type SpacesProps = {
203
101
  * Useful for if you already have the spaces in your app and don't want the spaces provider to have to fetch them again. */
204
102
  spaces?: Space[];
205
103
  };
206
- type UseSpaces = (...ids: string[]) => (Space | SsoTypeSpace)[] | undefined;
104
+ type UseSpaces = (...ids: string[]) => (Space)[] | undefined;
207
105
 
208
106
  declare const INITIAL_STATE: {
209
107
  loading: boolean;
@@ -213,6 +111,105 @@ declare const useSpacesContext: () => SpacesContextType;
213
111
  declare const Spaces: ({ query, variables, clientId, children, payerIds, spaceIds, spaces: spacesFromProps, }: SpacesProps) => JSX.Element;
214
112
  declare const useSpaces: UseSpaces;
215
113
 
114
+ type SpacesLinkVariants = 'card' | 'list' | 'default' | undefined;
115
+ type SpacesLinkWithSpace = {
116
+ /** If no spaceId is provided, the first space in the spaces array is used.
117
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
118
+ */
119
+ spaceId?: string;
120
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
121
+ * This component does not have to be a child of SpacesProvider.
122
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
123
+ */
124
+ space: Space;
125
+ } & SpacesLinkProps;
126
+ type SpacesLinkWithSpaceId = {
127
+ /** If no spaceId is provided, the first space in the spaces array is used.
128
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
129
+ */
130
+ spaceId: string;
131
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
132
+ * This component does not have to be a child of SpacesProvider.
133
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
134
+ */
135
+ space?: Space;
136
+ } & SpacesLinkProps;
137
+ type SpacesLinkProps = {
138
+ /** Children can be a react child or render prop. */
139
+ children?: JSX.Element | ((props: any | undefined) => JSX.Element);
140
+ /** Tag to overwrite the root component rendered. */
141
+ tag?: ElementType<any, keyof JSX.IntrinsicElements>;
142
+ /** Tag to overwrite the body component that renders the title, description and data values.
143
+ * It defaults to CardBody or div depending on the value of the variant prop.
144
+ */
145
+ bodyTag?: ElementType<any, keyof JSX.IntrinsicElements>;
146
+ /** Tag to overwrite the title component. If variant prop is set to "card", defaults to CardTitle.
147
+ * If variant is set to "list", defaults to ListItemHeading. Overwise, defaults to div.
148
+ */
149
+ titleTag?: ElementType<any, keyof JSX.IntrinsicElements>;
150
+ /** Tag to overwrite the text component. If variant prop is set to "card", defaults to Card Text.
151
+ * If variant is set to "list", defaults to ListItemText. Otherwise, defaults to div.
152
+ */
153
+ textTag?: ElementType<any, keyof JSX.IntrinsicElements>;
154
+ titleClassName?: string;
155
+ /** When true, utilizes the Card component for styling. */
156
+ card?: boolean;
157
+ /** When true, renders an @availity/mui-icon next to the title if present on the Space. */
158
+ icon?: (props: SvgIconProps) => JSX.Element;
159
+ /** When true, renders the Spaces description beneath the title. */
160
+ description?: boolean;
161
+ /** When passed in, provides predefined styles for the component.
162
+ * @default 'default'
163
+ */
164
+ variant?: SpacesLinkVariants;
165
+ /** When true, renders the FavoriteHeart component to the left of the Component.
166
+ * Note, this does require you to have wrapped your component somewhere in the Favorites Provider.
167
+ * This also requires the peerDependency @tanstack/react-query.
168
+ */
169
+ favorite?: boolean;
170
+ /** When true, renders the tyitle, and allow for the description and date info to be added on.
171
+ * @default true
172
+ */
173
+ body?: boolean;
174
+ /** When true, renders the activeDate of the space. */
175
+ showDate?: boolean;
176
+ /** When true, renders the name of the space.
177
+ * @default true
178
+ */
179
+ showName?: boolean;
180
+ /** When true, renders a "New!" badge if the activeDate is less than 30 days old. */
181
+ showNew?: boolean;
182
+ /** When true, renders the component vertically. */
183
+ stacked?: boolean;
184
+ /** Optionally pass in your own landing state for the component if you are managing the state yourself. */
185
+ loading?: boolean;
186
+ /** Required when space is not provided, or space is provided and space contains an sso link. */
187
+ clientId?: string;
188
+ style?: object;
189
+ className?: string;
190
+ /** Allows the description length to be truncated. */
191
+ maxDescriptionWidth?: string;
192
+ /** Additional attributes you may want to tack onto the native-form when submitting a SAML sso.
193
+ * i.e. spaceId or sourceApplicationId
194
+ */
195
+ linkAttributes?: object;
196
+ /** Allows the role of the root component to be overwritten.
197
+ * If variant prop is set to "list", defaults to "listitem".
198
+ */
199
+ role?: string;
200
+ /** When Analytics props are passed inside the analytics props, they will be passed down to the click item.
201
+ * For more information on Analytics props see: Autotrack Logged Events
202
+ */
203
+ analytics?: object;
204
+ customBadgeText?: string;
205
+ customBadgeColor?: StatusChipProps['color'];
206
+ /** prefix for ids to prevent duplicates when the same config link is displayed on the page more than once
207
+ * @default ''
208
+ */
209
+ idPrefix?: string;
210
+ [key: string]: any;
211
+ };
212
+
216
213
  declare const SpacesLink: ({ spaceId, space: propSpace, className, children, favorite, icon: FileIcon, showName, showNew, showDate, stacked, body, description: showDescription, tag, bodyTag, titleTag, textTag, titleClassName, variant, loading: propsLoading, clientId: propsClientId, maxDescriptionWidth, style, linkAttributes, role, analytics, customBadgeText, customBadgeColor, idPrefix, ...rest }: SpacesLinkWithSpace | SpacesLinkWithSpaceId) => react_jsx_runtime.JSX.Element;
217
214
 
218
215
  type SpacesAgreementProps = {
package/dist/index.d.ts CHANGED
@@ -1,110 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ElementType } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import { StatusChipProps } from '@availity/mui-chip';
4
5
  import { SvgIconProps } from '@mui/material';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
-
7
- type SpacesLinkVariants = 'card' | 'list' | 'default' | undefined;
8
- type SpacesLinkWithSpace = {
9
- /** If no spaceId is provided, the first space in the spaces array is used.
10
- * Note: This is only to be used when the Spaces provider should only ever contain a single space.
11
- */
12
- spaceId?: string;
13
- /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
14
- * This component does not have to be a child of SpacesProvider.
15
- * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
16
- */
17
- space: Space | SsoTypeSpace;
18
- } & SpacesLinkProps;
19
- type SpacesLinkWithSpaceId = {
20
- /** If no spaceId is provided, the first space in the spaces array is used.
21
- * Note: This is only to be used when the Spaces provider should only ever contain a single space.
22
- */
23
- spaceId: string;
24
- /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
25
- * This component does not have to be a child of SpacesProvider.
26
- * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
27
- */
28
- space?: Space | SsoTypeSpace;
29
- } & SpacesLinkProps;
30
- type SpacesLinkProps = {
31
- /** Children can be a react child or render prop. */
32
- children?: JSX.Element | ((props: any | undefined) => JSX.Element);
33
- /** Tag to overwrite the root component rendered. */
34
- tag?: ElementType<any, keyof JSX.IntrinsicElements>;
35
- /** Tag to overwrite the body component that renders the title, description and data values.
36
- * It defaults to CardBody or div depending on the value of the variant prop.
37
- */
38
- bodyTag?: ElementType<any, keyof JSX.IntrinsicElements>;
39
- /** Tag to overwrite the title component. If variant prop is set to "card", defaults to CardTitle.
40
- * If variant is set to "list", defaults to ListItemHeading. Overwise, defaults to div.
41
- */
42
- titleTag?: ElementType<any, keyof JSX.IntrinsicElements>;
43
- /** Tag to overwrite the text component. If variant prop is set to "card", defaults to Card Text.
44
- * If variant is set to "list", defaults to ListItemText. Otherwise, defaults to div.
45
- */
46
- textTag?: ElementType<any, keyof JSX.IntrinsicElements>;
47
- titleClassName?: string;
48
- /** When true, utilizes the Card component for styling. */
49
- card?: boolean;
50
- /** When true, renders an @availity/mui-icon next to the title if present on the Space. */
51
- icon?: (props: SvgIconProps) => JSX.Element;
52
- /** When true, renders the Spaces description beneath the title. */
53
- description?: boolean;
54
- /** When passed in, provides predefined styles for the component.
55
- * @default 'default'
56
- */
57
- variant?: SpacesLinkVariants;
58
- /** When true, renders the FavoriteHeart component to the left of the Component.
59
- * Note, this does require you to have wrapped your component somewhere in the Favorites Provider.
60
- * This also requires the peerDependency @tanstack/react-query.
61
- */
62
- favorite?: boolean;
63
- /** When true, renders the tyitle, and allow for the description and date info to be added on.
64
- * @default true
65
- */
66
- body?: boolean;
67
- /** When true, renders the activeDate of the space. */
68
- showDate?: boolean;
69
- /** When true, renders the name of the space.
70
- * @default true
71
- */
72
- showName?: boolean;
73
- /** When true, renders a "New!" badge if the activeDate is less than 30 days old. */
74
- showNew?: boolean;
75
- /** When true, renders the component vertically. */
76
- stacked?: boolean;
77
- /** Optionally pass in your own landing state for the component if you are managing the state yourself. */
78
- loading?: boolean;
79
- /** Required when space is not provided, or space is provided and space contains an sso link. */
80
- clientId?: string;
81
- style?: object;
82
- className?: string;
83
- /** Allows the description length to be truncated. */
84
- maxDescriptionWidth?: string;
85
- /** Additional attributes you may want to tack onto the native-form when submitting a SAML sso.
86
- * i.e. spaceId or sourceApplicationId
87
- */
88
- linkAttributes?: object;
89
- /** Allows the role of the root component to be overwritten.
90
- * If variant prop is set to "list", defaults to "listitem".
91
- */
92
- role?: string;
93
- /** When Analytics props are passed inside the analytics props, they will be passed down to the click item.
94
- * For more information on Analytics props see: Autotrack Logged Events
95
- */
96
- analytics?: object;
97
- customBadgeText?: string;
98
- customBadgeColor?: StatusChipProps['color'];
99
- /** prefix for ids to prevent duplicates when the same config link is displayed on the page more than once
100
- * @default ''
101
- */
102
- idPrefix?: string;
103
- [key: string]: any;
104
- };
105
- interface SsoTypeSpace extends Space {
106
- type: 'saml' | 'openid';
107
- }
108
6
 
109
7
  type Link = {
110
8
  /** Contains a URL or URL Fragment that the hyperlink points to. */
@@ -163,7 +61,7 @@ type Space = {
163
61
  };
164
62
  type SpacesContextType = {
165
63
  /** Array of spaces to be passed into the Spaces provider. */
166
- spaces?: Map<string, Space | SsoTypeSpace>;
64
+ spaces?: Map<string, Space>;
167
65
  /** Array of spaces from previous page load. */
168
66
  previousSpacesMap?: Map<string, Space>;
169
67
  /** Array of spaces organized by configurationId. */
@@ -203,7 +101,7 @@ type SpacesProps = {
203
101
  * Useful for if you already have the spaces in your app and don't want the spaces provider to have to fetch them again. */
204
102
  spaces?: Space[];
205
103
  };
206
- type UseSpaces = (...ids: string[]) => (Space | SsoTypeSpace)[] | undefined;
104
+ type UseSpaces = (...ids: string[]) => (Space)[] | undefined;
207
105
 
208
106
  declare const INITIAL_STATE: {
209
107
  loading: boolean;
@@ -213,6 +111,105 @@ declare const useSpacesContext: () => SpacesContextType;
213
111
  declare const Spaces: ({ query, variables, clientId, children, payerIds, spaceIds, spaces: spacesFromProps, }: SpacesProps) => JSX.Element;
214
112
  declare const useSpaces: UseSpaces;
215
113
 
114
+ type SpacesLinkVariants = 'card' | 'list' | 'default' | undefined;
115
+ type SpacesLinkWithSpace = {
116
+ /** If no spaceId is provided, the first space in the spaces array is used.
117
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
118
+ */
119
+ spaceId?: string;
120
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
121
+ * This component does not have to be a child of SpacesProvider.
122
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
123
+ */
124
+ space: Space;
125
+ } & SpacesLinkProps;
126
+ type SpacesLinkWithSpaceId = {
127
+ /** If no spaceId is provided, the first space in the spaces array is used.
128
+ * Note: This is only to be used when the Spaces provider should only ever contain a single space.
129
+ */
130
+ spaceId: string;
131
+ /** Use to directly pass a space to the component rather than have it fetched from the spaces API.
132
+ * This component does not have to be a child of SpacesProvider.
133
+ * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
134
+ */
135
+ space?: Space;
136
+ } & SpacesLinkProps;
137
+ type SpacesLinkProps = {
138
+ /** Children can be a react child or render prop. */
139
+ children?: JSX.Element | ((props: any | undefined) => JSX.Element);
140
+ /** Tag to overwrite the root component rendered. */
141
+ tag?: ElementType<any, keyof JSX.IntrinsicElements>;
142
+ /** Tag to overwrite the body component that renders the title, description and data values.
143
+ * It defaults to CardBody or div depending on the value of the variant prop.
144
+ */
145
+ bodyTag?: ElementType<any, keyof JSX.IntrinsicElements>;
146
+ /** Tag to overwrite the title component. If variant prop is set to "card", defaults to CardTitle.
147
+ * If variant is set to "list", defaults to ListItemHeading. Overwise, defaults to div.
148
+ */
149
+ titleTag?: ElementType<any, keyof JSX.IntrinsicElements>;
150
+ /** Tag to overwrite the text component. If variant prop is set to "card", defaults to Card Text.
151
+ * If variant is set to "list", defaults to ListItemText. Otherwise, defaults to div.
152
+ */
153
+ textTag?: ElementType<any, keyof JSX.IntrinsicElements>;
154
+ titleClassName?: string;
155
+ /** When true, utilizes the Card component for styling. */
156
+ card?: boolean;
157
+ /** When true, renders an @availity/mui-icon next to the title if present on the Space. */
158
+ icon?: (props: SvgIconProps) => JSX.Element;
159
+ /** When true, renders the Spaces description beneath the title. */
160
+ description?: boolean;
161
+ /** When passed in, provides predefined styles for the component.
162
+ * @default 'default'
163
+ */
164
+ variant?: SpacesLinkVariants;
165
+ /** When true, renders the FavoriteHeart component to the left of the Component.
166
+ * Note, this does require you to have wrapped your component somewhere in the Favorites Provider.
167
+ * This also requires the peerDependency @tanstack/react-query.
168
+ */
169
+ favorite?: boolean;
170
+ /** When true, renders the tyitle, and allow for the description and date info to be added on.
171
+ * @default true
172
+ */
173
+ body?: boolean;
174
+ /** When true, renders the activeDate of the space. */
175
+ showDate?: boolean;
176
+ /** When true, renders the name of the space.
177
+ * @default true
178
+ */
179
+ showName?: boolean;
180
+ /** When true, renders a "New!" badge if the activeDate is less than 30 days old. */
181
+ showNew?: boolean;
182
+ /** When true, renders the component vertically. */
183
+ stacked?: boolean;
184
+ /** Optionally pass in your own landing state for the component if you are managing the state yourself. */
185
+ loading?: boolean;
186
+ /** Required when space is not provided, or space is provided and space contains an sso link. */
187
+ clientId?: string;
188
+ style?: object;
189
+ className?: string;
190
+ /** Allows the description length to be truncated. */
191
+ maxDescriptionWidth?: string;
192
+ /** Additional attributes you may want to tack onto the native-form when submitting a SAML sso.
193
+ * i.e. spaceId or sourceApplicationId
194
+ */
195
+ linkAttributes?: object;
196
+ /** Allows the role of the root component to be overwritten.
197
+ * If variant prop is set to "list", defaults to "listitem".
198
+ */
199
+ role?: string;
200
+ /** When Analytics props are passed inside the analytics props, they will be passed down to the click item.
201
+ * For more information on Analytics props see: Autotrack Logged Events
202
+ */
203
+ analytics?: object;
204
+ customBadgeText?: string;
205
+ customBadgeColor?: StatusChipProps['color'];
206
+ /** prefix for ids to prevent duplicates when the same config link is displayed on the page more than once
207
+ * @default ''
208
+ */
209
+ idPrefix?: string;
210
+ [key: string]: any;
211
+ };
212
+
216
213
  declare const SpacesLink: ({ spaceId, space: propSpace, className, children, favorite, icon: FileIcon, showName, showNew, showDate, stacked, body, description: showDescription, tag, bodyTag, titleTag, textTag, titleClassName, variant, loading: propsLoading, clientId: propsClientId, maxDescriptionWidth, style, linkAttributes, role, analytics, customBadgeText, customBadgeColor, idPrefix, ...rest }: SpacesLinkWithSpace | SpacesLinkWithSpaceId) => react_jsx_runtime.JSX.Element;
217
214
 
218
215
  type SpacesAgreementProps = {
package/dist/index.js CHANGED
@@ -787,9 +787,14 @@ var openLink = (space, params) => __async(void 0, null, function* () {
787
787
  }
788
788
  if (params == null ? void 0 : params.akaname) yield updateTopApps(space, params.akaname);
789
789
  const spaceId = (params == null ? void 0 : params.payerSpaceId) || ((_c = (_b = space.parents) == null ? void 0 : _b[0]) == null ? void 0 : _c.id);
790
- const needsSpaceId = !(0, import_resolve_url2.isAbsoluteUrl)(space.link.url) || /(test|qa(p?)-)?essentials\.availity\.com/.test(space.link.url);
790
+ const essentialsDomainRegex = /(test|qa(p?)-)?essentials\.availity\.com/;
791
+ const needsSpaceId = !(0, import_resolve_url2.isAbsoluteUrl)(space.link.url) || essentialsDomainRegex.test(space.link.url);
791
792
  const urlWithParams = needsSpaceId ? updateUrl(space.link.url, "spaceId", spaceId) : space.link.url;
792
- const url = !(0, import_resolve_url2.isAbsoluteUrl)(space.link.url) ? getUrl(urlWithParams, false, false) : urlWithParams;
793
+ let url = !(0, import_resolve_url2.isAbsoluteUrl)(space.link.url) ? getUrl(urlWithParams, false, false) : urlWithParams;
794
+ if (!(0, import_resolve_url2.isAbsoluteUrl)(url) && essentialsDomainRegex.test(window.location.origin) && /\/web\/|\/public\/(apps|spaces)/.test(url)) {
795
+ const appsDomain = window.location.origin.replace("essentials", "apps");
796
+ url = `${appsDomain}${url}`;
797
+ }
793
798
  const target = getTarget(space.link.target);
794
799
  window.open(url, target);
795
800
  });
@@ -816,7 +821,6 @@ var openLinkWithSso = (_0, _1) => __async(void 0, [_0, _1], function* (space, {
816
821
  });
817
822
 
818
823
  // src/lib/SpacesLink/useLink.tsx
819
- var isSsoSpace = (space) => (space == null ? void 0 : space.type) === "saml" || (space == null ? void 0 : space.type) === "openid";
820
824
  var useLink = (spaceOrSpaceId, options) => {
821
825
  var _a, _b, _c, _d;
822
826
  const spaceFromSpacesProvider = useSpaces(
@@ -859,7 +863,7 @@ var useLink = (spaceOrSpaceId, options) => {
859
863
  const mediaProps = {
860
864
  role: "link"
861
865
  };
862
- if (isSsoSpace(space) && ((_b = space == null ? void 0 : space.meta) == null ? void 0 : _b.ssoId)) {
866
+ if ((_b = space == null ? void 0 : space.meta) == null ? void 0 : _b.ssoId) {
863
867
  if (!(options == null ? void 0 : options.clientId)) {
864
868
  throw new Error("clientId is required for SSO spaces");
865
869
  }
package/dist/index.mjs CHANGED
@@ -745,9 +745,14 @@ var openLink = (space, params) => __async(void 0, null, function* () {
745
745
  }
746
746
  if (params == null ? void 0 : params.akaname) yield updateTopApps(space, params.akaname);
747
747
  const spaceId = (params == null ? void 0 : params.payerSpaceId) || ((_c = (_b = space.parents) == null ? void 0 : _b[0]) == null ? void 0 : _c.id);
748
- const needsSpaceId = !isAbsoluteUrl2(space.link.url) || /(test|qa(p?)-)?essentials\.availity\.com/.test(space.link.url);
748
+ const essentialsDomainRegex = /(test|qa(p?)-)?essentials\.availity\.com/;
749
+ const needsSpaceId = !isAbsoluteUrl2(space.link.url) || essentialsDomainRegex.test(space.link.url);
749
750
  const urlWithParams = needsSpaceId ? updateUrl(space.link.url, "spaceId", spaceId) : space.link.url;
750
- const url = !isAbsoluteUrl2(space.link.url) ? getUrl(urlWithParams, false, false) : urlWithParams;
751
+ let url = !isAbsoluteUrl2(space.link.url) ? getUrl(urlWithParams, false, false) : urlWithParams;
752
+ if (!isAbsoluteUrl2(url) && essentialsDomainRegex.test(window.location.origin) && /\/web\/|\/public\/(apps|spaces)/.test(url)) {
753
+ const appsDomain = window.location.origin.replace("essentials", "apps");
754
+ url = `${appsDomain}${url}`;
755
+ }
751
756
  const target = getTarget(space.link.target);
752
757
  window.open(url, target);
753
758
  });
@@ -774,7 +779,6 @@ var openLinkWithSso = (_0, _1) => __async(void 0, [_0, _1], function* (space, {
774
779
  });
775
780
 
776
781
  // src/lib/SpacesLink/useLink.tsx
777
- var isSsoSpace = (space) => (space == null ? void 0 : space.type) === "saml" || (space == null ? void 0 : space.type) === "openid";
778
782
  var useLink = (spaceOrSpaceId, options) => {
779
783
  var _a, _b, _c, _d;
780
784
  const spaceFromSpacesProvider = useSpaces(
@@ -817,7 +821,7 @@ var useLink = (spaceOrSpaceId, options) => {
817
821
  const mediaProps = {
818
822
  role: "link"
819
823
  };
820
- if (isSsoSpace(space) && ((_b = space == null ? void 0 : space.meta) == null ? void 0 : _b.ssoId)) {
824
+ if ((_b = space == null ? void 0 : space.meta) == null ? void 0 : _b.ssoId) {
821
825
  if (!(options == null ? void 0 : options.clientId)) {
822
826
  throw new Error("clientId is required for SSO spaces");
823
827
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-spaces",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Availity MUI Spaces Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -84,7 +84,7 @@
84
84
  "@availity/api-axios": "^11.0.0",
85
85
  "@availity/hooks": "^5.1.5",
86
86
  "@availity/message-core": "^8.0.0",
87
- "@availity/native-form": "^7.0.0",
87
+ "@availity/native-form": "^7.0.1",
88
88
  "@availity/resolve-url": "^4.0.0",
89
89
  "@tanstack/react-query": "^4.36.1",
90
90
  "dayjs": "^1.11.13",
@@ -4,7 +4,6 @@ import { spacesReducer, fetchAllSpaces } from './spaces-data';
4
4
  import configurationFindMany from './configurationFindMany';
5
5
  import { ModalProvider } from './modals/ModalProvider';
6
6
  import type { Space, SpacesProps, SpacesContextType, UseSpaces } from './spaces-types';
7
- import type { SsoTypeSpace } from './SpacesLink/spaces-link-types';
8
7
  import { isReactNodeFunction } from './helpers';
9
8
 
10
9
  export const INITIAL_STATE = {
@@ -206,7 +205,7 @@ export const useSpaces: UseSpaces = (...ids) => {
206
205
  return spaces && [...spaces.values()];
207
206
  }
208
207
 
209
- return ids.reduce((acc: (Space | SsoTypeSpace)[], id) => {
208
+ return ids.reduce((acc: (Space)[], id) => {
210
209
  const matchedSpace = spaces?.get(id) || spacesByConfig?.get(id);
211
210
 
212
211
  if (matchedSpace) {
@@ -12,10 +12,18 @@ export const openLink: OpenLink = async (space, params) => {
12
12
  if (params?.akaname) await updateTopApps(space, params.akaname);
13
13
 
14
14
  const spaceId = params?.payerSpaceId || space.parents?.[0]?.id;
15
+
16
+ const essentialsDomainRegex = /(test|qa(p?)-)?essentials\.availity\.com/;
15
17
  const needsSpaceId =
16
- !isAbsoluteUrl(space.link.url) || /(test|qa(p?)-)?essentials\.availity\.com/.test(space.link.url);
18
+ !isAbsoluteUrl(space.link.url) || essentialsDomainRegex.test(space.link.url);
17
19
  const urlWithParams = needsSpaceId ? updateUrl(space.link.url, 'spaceId', spaceId) : space.link.url;
18
- const url = !isAbsoluteUrl(space.link.url) ? getUrl(urlWithParams, false, false) : urlWithParams;
20
+
21
+ let url = !isAbsoluteUrl(space.link.url) ? getUrl(urlWithParams, false, false) : urlWithParams;
22
+
23
+ if (!isAbsoluteUrl(url) && essentialsDomainRegex.test(window.location.origin) && /\/web\/|\/public\/(apps|spaces)/.test(url)) {
24
+ const appsDomain = window.location.origin.replace("essentials", "apps");
25
+ url = `${appsDomain}${url}`
26
+ }
19
27
 
20
28
  const target = getTarget(space.link.target);
21
29
 
@@ -14,7 +14,7 @@ export type SpacesLinkWithSpace = {
14
14
  * This component does not have to be a child of SpacesProvider.
15
15
  * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
16
16
  */
17
- space: Space | SsoTypeSpace;
17
+ space: Space;
18
18
  } & SpacesLinkProps;
19
19
 
20
20
  export type SpacesLinkWithSpaceId = {
@@ -26,7 +26,7 @@ export type SpacesLinkWithSpaceId = {
26
26
  * This component does not have to be a child of SpacesProvider.
27
27
  * Note: If you are wanting to take advantage of the sso links you will additionally need to pass the clientId in.
28
28
  */
29
- space?: Space | SsoTypeSpace;
29
+ space?: Space;
30
30
  } & SpacesLinkProps;
31
31
 
32
32
  export type SpacesLinkProps = {
@@ -111,13 +111,9 @@ export type MediaProps = {
111
111
  onKeyDown?: (event: React.KeyboardEvent) => void;
112
112
  };
113
113
 
114
- export interface SsoTypeSpace extends Space {
115
- type: 'saml' | 'openid';
116
- }
117
-
118
114
  export type UseLink = {
119
115
  (
120
- spaceId?: Space | SsoTypeSpace | string,
116
+ spaceId?: Space | string,
121
117
  options?: { clientId?: string; linkAttributes?: Record<string, any> }
122
118
  ): [Space | undefined, MediaProps | undefined];
123
119
  };
@@ -134,7 +130,7 @@ export type OpenLink = {
134
130
 
135
131
  export type OpenLinkWithSso = {
136
132
  (
137
- space: SsoTypeSpace,
133
+ space: Space,
138
134
  params: {
139
135
  akaname?: string;
140
136
  clientId: string;
@@ -4,14 +4,13 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
4
  import { Spaces } from '../Spaces';
5
5
  import { SpacesLink } from './SpacesLink';
6
6
  import type { Space } from '../spaces-types';
7
- import type { SsoTypeSpace } from './spaces-link-types';
8
7
 
9
8
  // eslint-disable-next-line @nx/enforce-module-boundaries
10
9
  import { server } from '@availity/mock/src/lib/server';
11
10
 
12
11
  jest.mock('@availity/native-form');
13
12
 
14
- const buildSpacesLink = (space: Space | SsoTypeSpace, linkAttributes: Record<any, any>) => {
13
+ const buildSpacesLink = (space: Space, linkAttributes: Record<any, any>) => {
15
14
  const queryClient = new QueryClient();
16
15
  return (
17
16
  <QueryClientProvider client={queryClient}>
@@ -30,6 +29,8 @@ const buildSpacesLink = (space: Space | SsoTypeSpace, linkAttributes: Record<any
30
29
  );
31
30
  };
32
31
 
32
+ const originalWindowLocation = window.location;
33
+
33
34
  describe('useLink', () => {
34
35
  beforeAll(() => {
35
36
  // Start the interception.
@@ -39,12 +40,17 @@ describe('useLink', () => {
39
40
  Object.defineProperty(window, 'open', { value: jest.fn() });
40
41
  });
41
42
  afterEach(() => {
43
+ Object.defineProperty(window, 'location', {
44
+ writable: true,
45
+ value: originalWindowLocation,
46
+ });
42
47
  jest.clearAllMocks();
43
48
  cleanup();
44
49
  server.resetHandlers();
50
+
45
51
  });
46
52
 
47
- const space: Space | SsoTypeSpace = {
53
+ const space: Space = {
48
54
  type: 'APPLICATION',
49
55
  name: 'an application',
50
56
  description: 'This is an application',
@@ -206,6 +212,8 @@ describe('useLink', () => {
206
212
  });
207
213
  });
208
214
 
215
+
216
+
209
217
  it('should call legacySSO on enter keypress with disclaimerId metadata', async () => {
210
218
  space.id = '8';
211
219
  space.configurationId = '8';
@@ -229,6 +237,7 @@ describe('useLink', () => {
229
237
  });
230
238
  });
231
239
 
240
+
232
241
  it('should call ssoId onclick with ssoId metadata', async () => {
233
242
  space.id = '9';
234
243
  space.configurationId = '9';
@@ -277,4 +286,27 @@ describe('useLink', () => {
277
286
  expect(window.open).not.toHaveBeenCalled();
278
287
  });
279
288
  });
289
+
290
+ it('should replace essentials with apps for onprem', async () => {
291
+ Object.defineProperty(window, 'location', {
292
+ value: new URL("https://test-essentials.availity.com"),
293
+ });
294
+
295
+ space.id = '11';
296
+ space.configurationId = '11';
297
+ space.link = { text: 'the link', target: '_self', url: '/public/spaces/url' };
298
+ space.type = 'APPLICATION';
299
+ space.meta = {};
300
+
301
+ const { container } = render(buildSpacesLink(space, { spaceId: space.id }));
302
+
303
+ const linkHeader11 = await waitFor(() => container.querySelector('#app-title-11'));
304
+
305
+ if (linkHeader11) fireEvent.click(linkHeader11);
306
+
307
+ await waitFor(() => {
308
+ expect(window.open).toHaveBeenCalledWith('https://test-apps.availity.com/public/spaces/url?spaceId=11', '_self');
309
+ expect(nativeForm).not.toHaveBeenCalled();
310
+ });
311
+ });
280
312
  });
@@ -2,11 +2,7 @@ import { useCurrentUser } from '@availity/hooks';
2
2
  import { useSpaces } from '../Spaces';
3
3
  import { useModal } from '../modals/ModalProvider';
4
4
  import { openLink, openLinkWithSso } from './linkHandlers';
5
- import type { UseLink, MediaProps, SsoTypeSpace } from './spaces-link-types';
6
- import { Space } from '../spaces-types';
7
-
8
- const isSsoSpace = (space: Space | SsoTypeSpace | undefined): space is SsoTypeSpace =>
9
- space?.type === 'saml' || space?.type === 'openid';
5
+ import type { UseLink, MediaProps } from './spaces-link-types';
10
6
 
11
7
  export const useLink: UseLink = (spaceOrSpaceId, options) => {
12
8
  const spaceFromSpacesProvider = useSpaces(
@@ -56,7 +52,7 @@ export const useLink: UseLink = (spaceOrSpaceId, options) => {
56
52
  role: 'link',
57
53
  };
58
54
 
59
- if (isSsoSpace(space) && space?.meta?.ssoId) {
55
+ if (space?.meta?.ssoId) {
60
56
  if (!options?.clientId) {
61
57
  throw new Error('clientId is required for SSO spaces');
62
58
  }
@@ -1,5 +1,3 @@
1
- import { SsoTypeSpace } from './SpacesLink/spaces-link-types';
2
-
3
1
  export type Link = {
4
2
  /** Contains a URL or URL Fragment that the hyperlink points to. */
5
3
  url?: string;
@@ -83,7 +81,7 @@ export type FetchAllSpacesProps = {
83
81
 
84
82
  export type SpacesContextType = {
85
83
  /** Array of spaces to be passed into the Spaces provider. */
86
- spaces?: Map<string, Space | SsoTypeSpace>;
84
+ spaces?: Map<string, Space>;
87
85
  /** Array of spaces from previous page load. */
88
86
  previousSpacesMap?: Map<string, Space>;
89
87
  /** Array of spaces organized by configurationId. */
@@ -135,4 +133,4 @@ export type SpacesProps = {
135
133
  spaces?: Space[];
136
134
  };
137
135
 
138
- export type UseSpaces = (...ids: string[]) => (Space | SsoTypeSpace)[] | undefined;
136
+ export type UseSpaces = (...ids: string[]) => (Space)[] | undefined;