@availity/mui-spaces 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.2.1](https://github.com/Availity/element/compare/@availity/mui-spaces@0.2.0...@availity/mui-spaces@0.2.1) (2024-06-17)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@availity/mock` updated to version `0.2.0`
10
+ ## [0.2.0](https://github.com/Availity/element/compare/@availity/mui-spaces@0.1.1...@availity/mui-spaces@0.2.0) (2024-06-14)
11
+
12
+ ### Dependency Updates
13
+
14
+ * `@availity/mock` updated to version `0.1.1`
15
+ * `mui-disclaimer` updated to version `0.1.1`
16
+ * `mui-modal` updated to version `0.1.1`
17
+ * `mui-typography` updated to version `0.1.1`
18
+ * `mui-progress` updated to version `0.1.1`
19
+
20
+ ### Features
21
+
22
+ * **mui-spaces:** add SpacesAgreement component ([0e4a299](https://github.com/Availity/element/commit/0e4a299ba4ae588bdc44a5035bbb5bcbfd234c7c))
23
+ * **mui-spaces:** add SpacesDisclaimer component ([5c5eeb4](https://github.com/Availity/element/commit/5c5eeb461d8a169c06a233094ae486b8c0075af5))
24
+ * **mui-spaces:** add SpacesGhostText component ([ceac190](https://github.com/Availity/element/commit/ceac190e012dad28bba87736d5dae64a85e6629a))
25
+ * **mui-spaces:** add SpacesImage component - initial commit ([0f0a00b](https://github.com/Availity/element/commit/0f0a00b5e6d5e5e759cf2e83f902454d8dbc19b1))
26
+
5
27
  ## [0.1.1](https://github.com/Availity/element/compare/@availity/mui-spaces@0.1.0...@availity/mui-spaces@0.1.1) (2024-05-17)
6
28
 
7
29
 
package/dist/index.d.mts CHANGED
@@ -6,6 +6,13 @@ type NameValuePair = {
6
6
  /** The value of the data. */
7
7
  value: string;
8
8
  };
9
+ type SpacesImages = {
10
+ billboard?: string;
11
+ logo?: string;
12
+ promotional?: string;
13
+ promotionalHover?: string;
14
+ tile?: string;
15
+ };
9
16
  type Space = {
10
17
  /** The name of the content or configuration. */
11
18
  name: string;
@@ -18,38 +25,30 @@ type Space = {
18
25
  /** A list of payerIds for the configuration or content. */
19
26
  payerIDs?: string[];
20
27
  /** The images associated with the configuration. */
21
- images?: NameValuePair[];
28
+ images?: SpacesImages;
29
+ /** Metadata for a configuration */
30
+ meta?: Record<string, string>;
22
31
  /** Key-value data for a configuration. */
23
- metadata?: NameValuePair[];
32
+ metadataPairs?: NameValuePair[];
24
33
  /** The feature box colors associated with the Payer Space. */
25
- colors?: NameValuePair[];
34
+ colors?: Record<string, string>;
26
35
  /** Contains URL fragments that point to icons. */
27
- icons?: NameValuePair[];
36
+ icons?: Record<string, string>;
28
37
  /** The key-value mapping pairs. */
29
- mapping?: NameValuePair[];
30
- };
31
- type NormalizedPairField = {
32
- [key: string]: string;
33
- };
34
- interface NormalizedSpace extends Omit<Space, 'images' | 'metadata' | 'colors' | 'icons' | 'mapping'> {
35
- /** The images associated with the configuration. */
36
- images?: NormalizedPairField;
37
- /** The feature box colors associated with the Payer Space. */
38
- colors?: NormalizedPairField;
39
- /** Contains URL fragments that point to icons. */
40
- icons?: NormalizedPairField;
41
- /** Key-value data for a configuration. */
42
- metadata?: NormalizedPairField;
43
- /** The key-value mapping pairs. */
44
- mapping?: NormalizedPairField;
45
- /** URL metadata for the configuration. */
38
+ mapping?: Record<string, string>;
39
+ mappingPairs?: NameValuePair[];
40
+ /** Whether or not the space is ghosted */
41
+ isGhost?: boolean;
46
42
  link?: {
47
43
  /** Contains a URL or URL Fragment that the hyperlink points to. */
48
44
  url: string;
49
45
  /** Specifies where to open the linked URL. */
50
46
  target: string;
51
47
  };
52
- }
48
+ /** The description of the configuration. */
49
+ description?: string;
50
+ url?: string;
51
+ };
53
52
  type SpacesContextType = {
54
53
  /** Array of spaces to be passed into the Spaces provider. */
55
54
  spaces?: Map<string, Space>;
@@ -99,6 +98,6 @@ declare const INITIAL_STATE: {
99
98
  declare const SpacesContext: react.Context<SpacesContextType>;
100
99
  declare const useSpacesContext: () => SpacesContextType;
101
100
  declare const Spaces: ({ query, variables, clientId, children, payerIds, spaceIds, spaces: spacesFromProps, }: SpacesProps) => JSX.Element;
102
- declare const useSpaces: (...ids: string[]) => NormalizedSpace[] | undefined;
101
+ declare const useSpaces: (...ids: string[]) => Space[] | undefined;
103
102
 
104
103
  export { INITIAL_STATE, Spaces, SpacesContext, useSpaces, useSpacesContext };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,13 @@ type NameValuePair = {
6
6
  /** The value of the data. */
7
7
  value: string;
8
8
  };
9
+ type SpacesImages = {
10
+ billboard?: string;
11
+ logo?: string;
12
+ promotional?: string;
13
+ promotionalHover?: string;
14
+ tile?: string;
15
+ };
9
16
  type Space = {
10
17
  /** The name of the content or configuration. */
11
18
  name: string;
@@ -18,38 +25,30 @@ type Space = {
18
25
  /** A list of payerIds for the configuration or content. */
19
26
  payerIDs?: string[];
20
27
  /** The images associated with the configuration. */
21
- images?: NameValuePair[];
28
+ images?: SpacesImages;
29
+ /** Metadata for a configuration */
30
+ meta?: Record<string, string>;
22
31
  /** Key-value data for a configuration. */
23
- metadata?: NameValuePair[];
32
+ metadataPairs?: NameValuePair[];
24
33
  /** The feature box colors associated with the Payer Space. */
25
- colors?: NameValuePair[];
34
+ colors?: Record<string, string>;
26
35
  /** Contains URL fragments that point to icons. */
27
- icons?: NameValuePair[];
36
+ icons?: Record<string, string>;
28
37
  /** The key-value mapping pairs. */
29
- mapping?: NameValuePair[];
30
- };
31
- type NormalizedPairField = {
32
- [key: string]: string;
33
- };
34
- interface NormalizedSpace extends Omit<Space, 'images' | 'metadata' | 'colors' | 'icons' | 'mapping'> {
35
- /** The images associated with the configuration. */
36
- images?: NormalizedPairField;
37
- /** The feature box colors associated with the Payer Space. */
38
- colors?: NormalizedPairField;
39
- /** Contains URL fragments that point to icons. */
40
- icons?: NormalizedPairField;
41
- /** Key-value data for a configuration. */
42
- metadata?: NormalizedPairField;
43
- /** The key-value mapping pairs. */
44
- mapping?: NormalizedPairField;
45
- /** URL metadata for the configuration. */
38
+ mapping?: Record<string, string>;
39
+ mappingPairs?: NameValuePair[];
40
+ /** Whether or not the space is ghosted */
41
+ isGhost?: boolean;
46
42
  link?: {
47
43
  /** Contains a URL or URL Fragment that the hyperlink points to. */
48
44
  url: string;
49
45
  /** Specifies where to open the linked URL. */
50
46
  target: string;
51
47
  };
52
- }
48
+ /** The description of the configuration. */
49
+ description?: string;
50
+ url?: string;
51
+ };
53
52
  type SpacesContextType = {
54
53
  /** Array of spaces to be passed into the Spaces provider. */
55
54
  spaces?: Map<string, Space>;
@@ -99,6 +98,6 @@ declare const INITIAL_STATE: {
99
98
  declare const SpacesContext: react.Context<SpacesContextType>;
100
99
  declare const useSpacesContext: () => SpacesContextType;
101
100
  declare const Spaces: ({ query, variables, clientId, children, payerIds, spaceIds, spaces: spacesFromProps, }: SpacesProps) => JSX.Element;
102
- declare const useSpaces: (...ids: string[]) => NormalizedSpace[] | undefined;
101
+ declare const useSpaces: (...ids: string[]) => Space[] | undefined;
103
102
 
104
103
  export { INITIAL_STATE, Spaces, SpacesContext, useSpaces, useSpacesContext };
package/dist/index.js CHANGED
@@ -20,18 +20,6 @@ var __spreadValues = (a, b) => {
20
20
  return a;
21
21
  };
22
22
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
- var __objRest = (source, exclude) => {
24
- var target = {};
25
- for (var prop in source)
26
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
- target[prop] = source[prop];
28
- if (source != null && __getOwnPropSymbols)
29
- for (var prop of __getOwnPropSymbols(source)) {
30
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
- target[prop] = source[prop];
32
- }
33
- return target;
34
- };
35
23
  var __export = (target, all) => {
36
24
  for (var name in all)
37
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -103,30 +91,6 @@ var spacesReducer = (state, action) => {
103
91
  const { type } = action;
104
92
  return actions[type](state, action);
105
93
  };
106
- var normalizeSpaces = (spaces) => {
107
- let spacesToReduce = spaces;
108
- if (Array.isArray(spaces[0])) {
109
- spacesToReduce = spaces[0];
110
- }
111
- const pairFields = ["images", "metadata", "colors", "icons", "mapping"];
112
- return spacesToReduce.reduce((accum, spc) => {
113
- var _b;
114
- if (!spc)
115
- return accum;
116
- const _a = spc, { images, metadata, colors, icons, mapping } = _a, rest = __objRest(_a, ["images", "metadata", "colors", "icons", "mapping"]);
117
- const normalizedSpace = __spreadValues({}, rest);
118
- for (const field of pairFields) {
119
- if (spc[field] && Array.isArray(spc[field])) {
120
- normalizedSpace[field] = (_b = spc[field]) == null ? void 0 : _b.reduce((_accum, { name, value }) => {
121
- _accum[name] = value;
122
- return _accum;
123
- }, {});
124
- }
125
- }
126
- accum.push(normalizedSpace);
127
- return accum;
128
- }, []);
129
- };
130
94
  var fetchSpaces = (_0) => __async(void 0, [_0], function* ({ query, clientId, variables }) {
131
95
  const {
132
96
  data: {
@@ -184,6 +148,7 @@ var configurationFindMany_default = `query configurationFindMany($ids: [String!]
184
148
  description
185
149
  payerIDs
186
150
  parentIDs
151
+ meta
187
152
  metadataPairs {
188
153
  name
189
154
  value
@@ -440,11 +405,20 @@ var useSpaces = (...ids) => {
440
405
  const shouldReturnAllSpaces = idsIsEmpty || callerIsExpectingFirstSpace;
441
406
  if (shouldReturnAllSpaces) {
442
407
  console.warn(`You did not pass in an ID to find a space, returning all spaces.`);
443
- return spaces && normalizeSpaces([...spaces.values()]);
408
+ return spaces && [...spaces.values()];
444
409
  }
445
- const matchedSpaces = ids.map((id) => (spaces == null ? void 0 : spaces.get(id)) || (spacesByConfig == null ? void 0 : spacesByConfig.get(id)) || (spacesByPayer == null ? void 0 : spacesByPayer.get(id)));
446
- const normalized = normalizeSpaces(matchedSpaces);
447
- return normalized;
410
+ return ids.reduce((acc, id) => {
411
+ const matchedSpace = (spaces == null ? void 0 : spaces.get(id)) || (spacesByConfig == null ? void 0 : spacesByConfig.get(id));
412
+ if (matchedSpace) {
413
+ acc.push(matchedSpace);
414
+ return acc;
415
+ }
416
+ const matchedSpacesByPayer = spacesByPayer == null ? void 0 : spacesByPayer.get(id);
417
+ if (matchedSpacesByPayer) {
418
+ acc.push(...matchedSpacesByPayer);
419
+ return acc;
420
+ }
421
+ }, []);
448
422
  };
449
423
  // Annotate the CommonJS export names for ESM import in node:
450
424
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -17,18 +17,6 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
20
  var __async = (__this, __arguments, generator) => {
33
21
  return new Promise((resolve, reject) => {
34
22
  var fulfilled = (value) => {
@@ -76,30 +64,6 @@ var spacesReducer = (state, action) => {
76
64
  const { type } = action;
77
65
  return actions[type](state, action);
78
66
  };
79
- var normalizeSpaces = (spaces) => {
80
- let spacesToReduce = spaces;
81
- if (Array.isArray(spaces[0])) {
82
- spacesToReduce = spaces[0];
83
- }
84
- const pairFields = ["images", "metadata", "colors", "icons", "mapping"];
85
- return spacesToReduce.reduce((accum, spc) => {
86
- var _b;
87
- if (!spc)
88
- return accum;
89
- const _a = spc, { images, metadata, colors, icons, mapping } = _a, rest = __objRest(_a, ["images", "metadata", "colors", "icons", "mapping"]);
90
- const normalizedSpace = __spreadValues({}, rest);
91
- for (const field of pairFields) {
92
- if (spc[field] && Array.isArray(spc[field])) {
93
- normalizedSpace[field] = (_b = spc[field]) == null ? void 0 : _b.reduce((_accum, { name, value }) => {
94
- _accum[name] = value;
95
- return _accum;
96
- }, {});
97
- }
98
- }
99
- accum.push(normalizedSpace);
100
- return accum;
101
- }, []);
102
- };
103
67
  var fetchSpaces = (_0) => __async(void 0, [_0], function* ({ query, clientId, variables }) {
104
68
  const {
105
69
  data: {
@@ -157,6 +121,7 @@ var configurationFindMany_default = `query configurationFindMany($ids: [String!]
157
121
  description
158
122
  payerIDs
159
123
  parentIDs
124
+ meta
160
125
  metadataPairs {
161
126
  name
162
127
  value
@@ -413,11 +378,20 @@ var useSpaces = (...ids) => {
413
378
  const shouldReturnAllSpaces = idsIsEmpty || callerIsExpectingFirstSpace;
414
379
  if (shouldReturnAllSpaces) {
415
380
  console.warn(`You did not pass in an ID to find a space, returning all spaces.`);
416
- return spaces && normalizeSpaces([...spaces.values()]);
381
+ return spaces && [...spaces.values()];
417
382
  }
418
- const matchedSpaces = ids.map((id) => (spaces == null ? void 0 : spaces.get(id)) || (spacesByConfig == null ? void 0 : spacesByConfig.get(id)) || (spacesByPayer == null ? void 0 : spacesByPayer.get(id)));
419
- const normalized = normalizeSpaces(matchedSpaces);
420
- return normalized;
383
+ return ids.reduce((acc, id) => {
384
+ const matchedSpace = (spaces == null ? void 0 : spaces.get(id)) || (spacesByConfig == null ? void 0 : spacesByConfig.get(id));
385
+ if (matchedSpace) {
386
+ acc.push(matchedSpace);
387
+ return acc;
388
+ }
389
+ const matchedSpacesByPayer = spacesByPayer == null ? void 0 : spacesByPayer.get(id);
390
+ if (matchedSpacesByPayer) {
391
+ acc.push(...matchedSpacesByPayer);
392
+ return acc;
393
+ }
394
+ }, []);
421
395
  };
422
396
  export {
423
397
  INITIAL_STATE,
package/jest.config.js CHANGED
@@ -1,7 +1,41 @@
1
1
  const global = require('../../jest.config.global');
2
2
 
3
+ const esModules = [
4
+ 'bail',
5
+ 'character-entities',
6
+ 'comma-separated-tokens',
7
+ 'decode-named-character-reference',
8
+ 'devlop',
9
+ 'estree-util-is-identifier-name',
10
+ 'hast-util-to-jsx-runtime',
11
+ 'hast-util-whitespace',
12
+ 'html-url-attributes',
13
+ 'is-plain-obj',
14
+ 'mdast-util-from-markdown',
15
+ 'mdast-util-to-hast',
16
+ 'mdast-util-to-string',
17
+ 'micromark',
18
+ 'property-information',
19
+ 'react-markdown',
20
+ 'remark-parse',
21
+ 'remark-rehype',
22
+ 'space-separated-tokens',
23
+ 'trim-lines',
24
+ 'trough',
25
+ 'unified',
26
+ 'unist-util-is',
27
+ 'unist-util-position',
28
+ 'unist-util-stringify-position',
29
+ 'unist-util-visit',
30
+ 'vfile',
31
+ 'vfile-message',
32
+ ].join('|');
33
+
3
34
  module.exports = {
4
35
  ...global,
5
36
  displayName: 'spaces',
6
37
  coverageDirectory: '../../coverage/spaces',
38
+ transformIgnorePatterns: [
39
+ `/node_modules/(?!${esModules})`
40
+ ]
7
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-spaces",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Availity MUI Spaces Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -32,15 +32,28 @@
32
32
  "publish:canary": "yarn npm publish --access public --tag canary"
33
33
  },
34
34
  "devDependencies": {
35
+ "@availity/mock": "^0.0.0",
36
+ "@availity/mui-button": "^0.6.7",
37
+ "@availity/mui-disclaimer": "^0.1.1",
38
+ "@availity/mui-modal": "^0.1.4",
39
+ "@availity/mui-typography": "^0.2.0",
35
40
  "@mui/material": "^5.15.15",
36
41
  "react": "18.2.0",
37
42
  "react-dom": "18.2.0",
43
+ "react-image": "^4.1.0",
44
+ "react-markdown": "^9.0.1",
38
45
  "tsup": "^8.0.2",
39
46
  "typescript": "^5.4.5"
40
47
  },
41
48
  "peerDependencies": {
49
+ "@availity/mui-button": "^0.6.7",
50
+ "@availity/mui-disclaimer": "^0.1.1",
51
+ "@availity/mui-modal": "^0.1.4",
52
+ "@availity/mui-typography": "^0.2.0",
42
53
  "@mui/material": "^5.11.9",
43
- "react": ">=16.3.0"
54
+ "react": ">=16.3.0",
55
+ "react-image": "^4.1.0",
56
+ "react-markdown": "^9.0.1"
44
57
  },
45
58
  "publishConfig": {
46
59
  "access": "public"
@@ -48,12 +61,8 @@
48
61
  "dependencies": {
49
62
  "@availity/api-axios": "^8.0.7",
50
63
  "@availity/message-core": "^6.1.2",
51
- "@availity/mui-button": "^0.6.7",
52
- "@availity/mui-modal": "^0.1.3",
53
- "@availity/mui-typography": "^0.1.8",
54
64
  "@tanstack/react-query": "^4.36.1",
55
65
  "dayjs": "^1.11.10",
56
- "qs": "^6.12.1",
57
- "react-markdown": "^9.0.1"
66
+ "qs": "^6.12.1"
58
67
  }
59
68
  }
@@ -3,7 +3,6 @@
3
3
  import type { Meta, StoryObj } from '@storybook/react';
4
4
  import { Paper } from '@availity/mui-paper';
5
5
  import { Typography } from '@availity/mui-typography';
6
- import { Divider } from '@availity/mui-divider';
7
6
  import { Stack } from '@availity/mui-layout';
8
7
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
9
8
  import { Spaces, useSpaces, useSpacesContext } from './Spaces';
@@ -6,7 +6,6 @@ import { Spaces, useSpaces, useSpacesContext } from '..';
6
6
 
7
7
  // eslint-disable-next-line @nx/enforce-module-boundaries
8
8
  import { server } from '../../../mock/src/lib/server';
9
- import { NormalizedSpace } from './spaces-types';
10
9
 
11
10
  beforeAll(() => {
12
11
  // Start the interception.
@@ -1,6 +1,6 @@
1
1
  import { createContext, useContext, useReducer, useEffect } from 'react';
2
2
  import { useQueries } from '@tanstack/react-query';
3
- import { normalizeSpaces, spacesReducer, fetchAllSpaces } from './spaces-data';
3
+ import { spacesReducer, fetchAllSpaces } from './spaces-data';
4
4
  import { Space, SpacesProps, SpacesContextType } from './spaces-types';
5
5
  import configurationFindMany from './configurationFindMany';
6
6
 
@@ -192,11 +192,22 @@ export const useSpaces = (...ids: string[]) => {
192
192
 
193
193
  if (shouldReturnAllSpaces) {
194
194
  console.warn(`You did not pass in an ID to find a space, returning all spaces.`);
195
- return spaces && normalizeSpaces([...spaces.values()]);
195
+ return spaces && [...spaces.values()];
196
196
  }
197
197
 
198
- const matchedSpaces = ids.map((id) => spaces?.get(id) || spacesByConfig?.get(id) || spacesByPayer?.get(id));
199
- const normalized = normalizeSpaces(matchedSpaces);
198
+ return ids.reduce((acc: Space[], id) => {
199
+ const matchedSpace = spaces?.get(id) || spacesByConfig?.get(id);
200
200
 
201
- return normalized;
201
+ if (matchedSpace) {
202
+ acc.push(matchedSpace);
203
+ return acc;
204
+ }
205
+
206
+ const matchedSpacesByPayer = spacesByPayer?.get(id);
207
+
208
+ if (matchedSpacesByPayer) {
209
+ acc.push(...matchedSpacesByPayer);
210
+ return acc;
211
+ }
212
+ }, []);
202
213
  };
@@ -0,0 +1,49 @@
1
+ // Each exported component in the package should have its own stories file
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
+ import { Spaces } from './Spaces';
5
+ import { SpacesAgreement, SpacesAgreementProps } from './SpacesAgreement';
6
+
7
+ const meta: Meta<typeof SpacesAgreement> = {
8
+ title: 'Components/Spaces/SpacesAgreement',
9
+ component: SpacesAgreement,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ spaceId: {
13
+ table: {
14
+ readonly: true,
15
+ },
16
+ },
17
+ },
18
+ };
19
+
20
+ export default meta;
21
+
22
+ const queryClient = new QueryClient();
23
+
24
+ export const _SpacesAgreement: StoryObj<typeof SpacesAgreement> = {
25
+ render: (args: SpacesAgreementProps) => (
26
+ <QueryClientProvider client={queryClient}>
27
+ <Spaces clientId="clientId" spaceIds={['agreement']}>
28
+ <SpacesAgreement {...args} />
29
+ </Spaces>
30
+ </QueryClientProvider>
31
+ ),
32
+ args: {
33
+ spaceId: 'agreement',
34
+ },
35
+ };
36
+
37
+ export const _SpacesAgreementMarkdown: StoryObj<typeof SpacesAgreement> = {
38
+ render: (args: SpacesAgreementProps) => (
39
+ <QueryClientProvider client={queryClient}>
40
+ <Spaces clientId="clientId" spaceIds={['agreementMarkdown']}>
41
+ <SpacesAgreement {...args} />
42
+ </Spaces>
43
+ </QueryClientProvider>
44
+ ),
45
+ args: {
46
+ markdown: true,
47
+ spaceId: 'agreementMarkdown',
48
+ },
49
+ };
@@ -0,0 +1,53 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { render, waitFor } from '@testing-library/react';
3
+ // eslint-disable-next-line @nx/enforce-module-boundaries
4
+ import { server } from '../../../mock/src/lib/server';
5
+ import { SpacesAgreement } from './SpacesAgreement';
6
+ import { Spaces } from './Spaces';
7
+
8
+ beforeAll(() => {
9
+ // Start the interception.
10
+ server.listen();
11
+ });
12
+
13
+ afterEach(() => {
14
+ // Remove any handlers you may have added
15
+ // in individual tests (runtime handlers).
16
+ server.resetHandlers();
17
+ });
18
+
19
+ describe('SpacesAgreement', () => {
20
+ it('should render regular text successfully', async () => {
21
+ const queryClient = new QueryClient();
22
+
23
+ const { getByText } = render(
24
+ <QueryClientProvider client={queryClient}>
25
+ <Spaces spaceIds={['agreement']} clientId="clientId">
26
+ <SpacesAgreement spaceId="agreement" />
27
+ </Spaces>
28
+ </QueryClientProvider>
29
+ );
30
+
31
+ const agreementText = await waitFor(() => getByText('This is an agreement.'));
32
+
33
+ expect(agreementText.tagName).toBe('SPAN');
34
+ expect(agreementText.innerHTML).toBe('This is an agreement.');
35
+ });
36
+
37
+ it('should render markdown successfully', async () => {
38
+ const queryClient = new QueryClient();
39
+
40
+ const { getByText } = render(
41
+ <QueryClientProvider client={queryClient}>
42
+ <Spaces spaceIds={['agreementMarkdown']} clientId="clientId">
43
+ <SpacesAgreement spaceId="agreementMarkdown" markdown />
44
+ </Spaces>
45
+ </QueryClientProvider>
46
+ );
47
+
48
+ const agreementText = await waitFor(() => getByText('This is an agreement.'));
49
+
50
+ expect(agreementText.tagName).toBe('H1');
51
+ expect(agreementText.innerHTML).toBe('This is an agreement.');
52
+ });
53
+ });
@@ -0,0 +1,29 @@
1
+ import { Typography } from '@availity/mui-typography';
2
+ import ReactMarkdown from 'react-markdown';
3
+
4
+ import { useSpaces } from './Spaces';
5
+
6
+ export type SpacesAgreementProps = {
7
+ spaceId: string;
8
+ markdown?: boolean;
9
+ id?: string;
10
+ };
11
+
12
+ export const SpacesAgreement = ({ spaceId, markdown = false, id: elementId }: SpacesAgreementProps) => {
13
+ const spaces = useSpaces(spaceId);
14
+ if (spaces && spaces.length > 0) {
15
+ const { description: agreement, id } = spaces[0];
16
+
17
+ if (agreement) {
18
+ const children = markdown ? <ReactMarkdown>{agreement}</ReactMarkdown> : agreement;
19
+
20
+ return (
21
+ <Typography variant="agreement" id={elementId || `spaces-agreement-${spaceId || id}`}>
22
+ {children}
23
+ </Typography>
24
+ );
25
+ }
26
+ }
27
+
28
+ return null;
29
+ };
@@ -0,0 +1,49 @@
1
+ // Each exported component in the package should have its own stories file
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
+ import { Spaces } from './Spaces';
5
+ import { SpacesDisclaimer, SpacesDisclaimerProps } from './SpacesDisclaimer';
6
+
7
+ const meta: Meta<typeof SpacesDisclaimer> = {
8
+ title: 'Components/Spaces/SpacesDisclaimer',
9
+ component: SpacesDisclaimer,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ spaceId: {
13
+ table: {
14
+ readonly: true,
15
+ },
16
+ },
17
+ },
18
+ };
19
+
20
+ export default meta;
21
+
22
+ const queryClient = new QueryClient();
23
+
24
+ export const _SpacesDisclaimer: StoryObj<typeof SpacesDisclaimer> = {
25
+ render: (args: SpacesDisclaimerProps) => (
26
+ <QueryClientProvider client={queryClient}>
27
+ <Spaces clientId="clientId" spaceIds={['disclaimer']}>
28
+ <SpacesDisclaimer {...args} />
29
+ </Spaces>
30
+ </QueryClientProvider>
31
+ ),
32
+ args: {
33
+ spaceId: 'disclaimer',
34
+ },
35
+ };
36
+
37
+ export const _SpacesDisclaimerMarkdown: StoryObj<typeof SpacesDisclaimer> = {
38
+ render: (args: SpacesDisclaimerProps) => (
39
+ <QueryClientProvider client={queryClient}>
40
+ <Spaces clientId="clientId" spaceIds={['disclaimerMarkdown']}>
41
+ <SpacesDisclaimer {...args} />
42
+ </Spaces>
43
+ </QueryClientProvider>
44
+ ),
45
+ args: {
46
+ markdown: true,
47
+ spaceId: 'disclaimerMarkdown',
48
+ },
49
+ };
@@ -0,0 +1,53 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { render, waitFor } from '@testing-library/react';
3
+ // eslint-disable-next-line @nx/enforce-module-boundaries
4
+ import { server } from '@availity/mock/src/lib/server';
5
+ import { SpacesDisclaimer } from './SpacesDisclaimer';
6
+ import { Spaces } from './Spaces';
7
+
8
+ beforeAll(() => {
9
+ // Start the interception.
10
+ server.listen();
11
+ });
12
+
13
+ afterEach(() => {
14
+ // Remove any handlers you may have added
15
+ // in individual tests (runtime handlers).
16
+ server.resetHandlers();
17
+ });
18
+
19
+ describe('SpacesDisclaimer', () => {
20
+ it('should render regular text successfully', async () => {
21
+ const queryClient = new QueryClient();
22
+
23
+ const { getByText } = render(
24
+ <QueryClientProvider client={queryClient}>
25
+ <Spaces spaceIds={['disclaimer']} clientId="clientId">
26
+ <SpacesDisclaimer spaceId="disclaimer" />
27
+ </Spaces>
28
+ </QueryClientProvider>
29
+ );
30
+
31
+ const disclaimerText = await waitFor(() => getByText('This is a disclaimer.'));
32
+
33
+ expect(disclaimerText.tagName).toBe('P');
34
+ expect(disclaimerText.innerHTML).toBe('This is a disclaimer.');
35
+ });
36
+
37
+ it('should render markdown successfully', async () => {
38
+ const queryClient = new QueryClient();
39
+
40
+ const { getByText } = render(
41
+ <QueryClientProvider client={queryClient}>
42
+ <Spaces spaceIds={['disclaimerMarkdown']} clientId="clientId">
43
+ <SpacesDisclaimer spaceId="disclaimerMarkdown" markdown />
44
+ </Spaces>
45
+ </QueryClientProvider>
46
+ );
47
+
48
+ const disclaimerText = await waitFor(() => getByText('This is a disclaimer.'));
49
+
50
+ expect(disclaimerText.tagName).toBe('H1');
51
+ expect(disclaimerText.innerHTML).toBe('This is a disclaimer.');
52
+ });
53
+ });
@@ -0,0 +1,39 @@
1
+ import { Disclaimer } from '@availity/mui-disclaimer';
2
+ import ReactMarkdown from 'react-markdown';
3
+
4
+ import { useSpaces } from './Spaces';
5
+
6
+ export type SpacesDisclaimerProps = {
7
+ accent?: boolean;
8
+ spaceId: string;
9
+ markdown?: boolean;
10
+ id?: string;
11
+ };
12
+
13
+ export const SpacesDisclaimer = ({
14
+ accent = true,
15
+ spaceId,
16
+ markdown = false,
17
+ id: elementId,
18
+ ...props
19
+ }: SpacesDisclaimerProps) => {
20
+ const spaces = useSpaces(spaceId);
21
+ if (spaces && spaces.length > 0) {
22
+ const { description: disclaimer, id } = spaces[0];
23
+
24
+ if (disclaimer) {
25
+ const children = markdown ? <ReactMarkdown>{disclaimer}</ReactMarkdown> : disclaimer;
26
+
27
+ return (
28
+ <Disclaimer
29
+ accent={accent}
30
+ id={elementId || `spaces-disclaimer-${spaceId || id}`}
31
+ description={children}
32
+ {...props}
33
+ />
34
+ );
35
+ }
36
+ }
37
+
38
+ return null;
39
+ };
@@ -0,0 +1,35 @@
1
+ // Each exported component in the package should have its own stories file
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
+ import { Spaces } from './Spaces';
5
+ import { SpacesGhostText, SpacesGhostTextProps } from './SpacesGhostText';
6
+
7
+ const meta: Meta<typeof SpacesGhostText> = {
8
+ title: 'Components/Spaces/SpacesGhostText',
9
+ component: SpacesGhostText,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ spaceId: {
13
+ table: {
14
+ readonly: true,
15
+ },
16
+ },
17
+ },
18
+ };
19
+
20
+ export default meta;
21
+
22
+ const queryClient = new QueryClient();
23
+
24
+ export const _SpacesGhostText: StoryObj<typeof SpacesGhostText> = {
25
+ render: (args: SpacesGhostTextProps) => (
26
+ <QueryClientProvider client={queryClient}>
27
+ <Spaces clientId="clientId" spaceIds={['ghosted']}>
28
+ <SpacesGhostText {...args} />
29
+ </Spaces>
30
+ </QueryClientProvider>
31
+ ),
32
+ args: {
33
+ spaceId: 'ghosted',
34
+ },
35
+ };
@@ -0,0 +1,33 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { render, waitFor } from '@testing-library/react';
3
+ // eslint-disable-next-line @nx/enforce-module-boundaries
4
+ import { server } from '@availity/mock/src/lib/server';
5
+ import { SpacesGhostText } from './SpacesGhostText';
6
+ import { Spaces } from './Spaces';
7
+
8
+ beforeAll(() => {
9
+ // Start the interception.
10
+ server.listen();
11
+ });
12
+
13
+ afterEach(() => {
14
+ // Remove any handlers you may have added
15
+ // in individual tests (runtime handlers).
16
+ server.resetHandlers();
17
+ });
18
+
19
+ describe('SpacesGhostText', () => {
20
+ it('should render successfully', async () => {
21
+ const queryClient = new QueryClient();
22
+
23
+ const { getByText } = render(
24
+ <QueryClientProvider client={queryClient}>
25
+ <Spaces spaceIds={['ghosted']} clientId="clientId">
26
+ <SpacesGhostText spaceId="ghosted" />
27
+ </Spaces>
28
+ </QueryClientProvider>
29
+ );
30
+
31
+ await waitFor(() => getByText('This is some ghost text'));
32
+ });
33
+ });
@@ -0,0 +1,22 @@
1
+ import { useSpaces } from './Spaces';
2
+
3
+ export type SpacesGhostTextProps = {
4
+ spaceId: string;
5
+ id?: string;
6
+ } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
7
+
8
+ export const SpacesGhostText = ({ spaceId, id, ...props }: SpacesGhostTextProps) => {
9
+ const spaces = useSpaces(spaceId);
10
+
11
+ const space = spaces?.[0];
12
+
13
+ if (space?.isGhost) {
14
+ return (
15
+ <small id={id || `app-ghost-text-${spaceId}`} {...props}>
16
+ <em>{space?.meta?.ghostText}</em>
17
+ </small>
18
+ );
19
+ }
20
+
21
+ return null;
22
+ };
@@ -0,0 +1,77 @@
1
+ // Each exported component in the package should have its own stories file
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4
+ import { Spaces } from './Spaces';
5
+ import { SpacesImage, SpacesImageProps } from './SpacesImage';
6
+
7
+ const meta: Meta<typeof SpacesImage> = {
8
+ title: 'Components/Spaces/SpacesImage',
9
+ component: SpacesImage,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ spaceId: {
13
+ table: {
14
+ readonly: true,
15
+ },
16
+ },
17
+ },
18
+ };
19
+
20
+ export default meta;
21
+
22
+ const queryClient = new QueryClient();
23
+
24
+ export const _SpacesImage: StoryObj<typeof SpacesImage> = {
25
+ render: (args: SpacesImageProps) => (
26
+ <QueryClientProvider client={queryClient}>
27
+ <Spaces clientId="clientId" spaceIds={['11', '22', '33']}>
28
+ <SpacesImage {...args} />
29
+ </Spaces>
30
+ </QueryClientProvider>
31
+ ),
32
+ args: {
33
+ spaceId: '33',
34
+ },
35
+ };
36
+
37
+ export const _SpacesLogo: StoryObj<typeof SpacesImage> = {
38
+ render: (args: SpacesImageProps) => (
39
+ <QueryClientProvider client={queryClient}>
40
+ <Spaces clientId="clientId" spaceIds={['11', '22', '33']}>
41
+ <SpacesImage {...args} />
42
+ </Spaces>
43
+ </QueryClientProvider>
44
+ ),
45
+ args: {
46
+ spaceId: '11',
47
+ imageType: 'images.logo',
48
+ },
49
+ };
50
+
51
+ export const _SpacesTile: StoryObj<typeof SpacesImage> = {
52
+ render: (args: SpacesImageProps) => (
53
+ <QueryClientProvider client={queryClient}>
54
+ <Spaces clientId="clientId" spaceIds={['11', '22', '33']}>
55
+ <SpacesImage {...args} />
56
+ </Spaces>
57
+ </QueryClientProvider>
58
+ ),
59
+ args: {
60
+ spaceId: '22',
61
+ imageType: 'images.tile',
62
+ },
63
+ };
64
+
65
+ export const _SpacesBillboard: StoryObj<typeof SpacesImage> = {
66
+ render: (args: SpacesImageProps) => (
67
+ <QueryClientProvider client={queryClient}>
68
+ <Spaces clientId="clientId" spaceIds={['11', '22', '33']}>
69
+ <SpacesImage {...args} />
70
+ </Spaces>
71
+ </QueryClientProvider>
72
+ ),
73
+ args: {
74
+ spaceId: '22',
75
+ imageType: 'images.billboard',
76
+ },
77
+ };
@@ -0,0 +1,45 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { render, waitForElementToBeRemoved } from '@testing-library/react';
3
+ // eslint-disable-next-line @nx/enforce-module-boundaries
4
+ import { server } from '@availity/mock/src/lib/server';
5
+ import { SpacesImage } from './SpacesImage';
6
+ import { Spaces } from './Spaces';
7
+
8
+ const mockImage = jest.fn();
9
+
10
+ jest.mock('react-image', () => ({
11
+ ...(jest.requireActual('react-image') as any),
12
+ Img: (props: any) => mockImage(props),
13
+ }));
14
+
15
+ beforeAll(() => {
16
+ // Start the interception.
17
+ server.listen();
18
+ });
19
+
20
+ afterEach(() => {
21
+ // Remove any handlers you may have added
22
+ // in individual tests (runtime handlers).
23
+ server.resetHandlers();
24
+ jest.restoreAllMocks();
25
+ });
26
+
27
+ describe('SpacesImage', () => {
28
+ it('should render successfully', async () => {
29
+ const queryClient = new QueryClient();
30
+
31
+ const { getByRole } = render(
32
+ <QueryClientProvider client={queryClient}>
33
+ <Spaces spaceIds={['11', '22', '33']} clientId="clientId">
34
+ <SpacesImage spaceId="33" />
35
+ </Spaces>
36
+ </QueryClientProvider>
37
+ );
38
+
39
+ // Expect loader to display
40
+ await waitForElementToBeRemoved(getByRole('progressbar'));
41
+
42
+ // Ensure the correct src was selected.
43
+ expect(mockImage.mock.calls[0][0].src).toEqual('/element/spaces/tile.jpg');
44
+ });
45
+ });
@@ -0,0 +1,72 @@
1
+ import { CircularProgress } from '@availity/mui-progress';
2
+ import { Img } from 'react-image';
3
+ import { useSpaces, useSpacesContext } from './Spaces';
4
+
5
+ type BaseSpacesImageProps = {
6
+ imageType?:
7
+ | 'url'
8
+ | 'images.logo'
9
+ | 'images.tile'
10
+ | 'images.billboard'
11
+ | 'images.promotional'
12
+ | 'images.promotionalHover';
13
+ fallback?: string;
14
+ id?: string;
15
+ };
16
+
17
+ type SpacesImageSpaceId = {
18
+ spaceId: string;
19
+ payerId?: string;
20
+ } & BaseSpacesImageProps;
21
+
22
+ type SpacesImagePayerId = {
23
+ spaceId?: string;
24
+ payerId: string;
25
+ } & BaseSpacesImageProps;
26
+
27
+ export type SpacesImageProps = SpacesImageSpaceId | SpacesImagePayerId;
28
+
29
+ export const SpacesImage = ({ spaceId, payerId, imageType = 'url', fallback, ...props }: SpacesImageProps) => {
30
+ let spaces;
31
+
32
+ if (spaceId) {
33
+ spaces = useSpaces(spaceId);
34
+ } else if (payerId) {
35
+ spaces = useSpaces(payerId);
36
+ }
37
+
38
+ const { loading } = useSpacesContext();
39
+
40
+ const id = spaceId || payerId || spaces?.[0].id || spaces?.[0].configurationId;
41
+
42
+ const imageMap = {
43
+ 'images.logo': spaces?.[0]?.images?.logo,
44
+ 'images.tile': spaces?.[0]?.images?.tile,
45
+ 'images.billboard': spaces?.[0]?.images?.billboard,
46
+ 'images.promotional': spaces?.[0]?.images?.promotional,
47
+ 'images.promotionalHover': spaces?.[0]?.images?.promotionalHover,
48
+ url: spaces?.[0]?.url,
49
+ };
50
+
51
+ let url = imageMap[imageType];
52
+
53
+ if (!url && loading) {
54
+ return <CircularProgress id={`app-${id}-loading`} />;
55
+ }
56
+
57
+ if (!url && !loading && fallback) {
58
+ url = fallback;
59
+ }
60
+
61
+ if (!url || !id) return null;
62
+
63
+ return (
64
+ <Img
65
+ id={props.id || `app-img-${id}`}
66
+ src={url}
67
+ alt={`Space ${imageType}`}
68
+ loader={<CircularProgress id={`app-img-${id}-loading`} />}
69
+ {...props}
70
+ />
71
+ );
72
+ };
@@ -15,6 +15,7 @@ export default `query configurationFindMany($ids: [String!], $payerIDs: [ID!], $
15
15
  description
16
16
  payerIDs
17
17
  parentIDs
18
+ meta
18
19
  metadataPairs {
19
20
  name
20
21
  value
@@ -1,4 +1,4 @@
1
- import { normalizeSpaces, fetchAllSpaces } from './spaces-data';
1
+ import { fetchAllSpaces } from './spaces-data';
2
2
  import configurationFindMany from './configurationFindMany';
3
3
  // eslint-disable-next-line @nx/enforce-module-boundaries
4
4
  import { server } from '../../../mock/src/lib/server';
@@ -34,24 +34,3 @@ describe('getAllSpaces', () => {
34
34
  expect(spaces[spaces.length - 1].id).toBe('10');
35
35
  });
36
36
  });
37
-
38
- describe('normalizeSpaces', () => {
39
- it('normalizes space pairs', async () => {
40
- const spaces = [
41
- {
42
- id: '1',
43
- configurationId: '1',
44
- type: 'space',
45
- name: 'Space 1',
46
- metadata: [
47
- { name: 'a', value: '1' },
48
- { name: 'b', value: '2' },
49
- ],
50
- },
51
- ];
52
-
53
- const sanitized = normalizeSpaces(spaces);
54
-
55
- expect(sanitized[0].metadata).toEqual({ a: '1', b: '2' });
56
- });
57
- });
@@ -1,15 +1,5 @@
1
1
  import { avWebQLApi } from '@availity/api-axios';
2
- import {
3
- Space,
4
- NameValuePair,
5
- NormalizedSpace,
6
- NormalizedPairField,
7
- PairFields,
8
- FetchSpacesProps,
9
- FetchAllSpacesProps,
10
- SpacesContextType,
11
- SpacesReducerAction,
12
- } from './spaces-types';
2
+ import { Space, FetchSpacesProps, FetchAllSpacesProps, SpacesContextType, SpacesReducerAction } from './spaces-types';
13
3
 
14
4
  export const actions = {
15
5
  SPACES: (
@@ -38,36 +28,6 @@ export const spacesReducer = (state: SpacesContextType, action: SpacesReducerAct
38
28
  return actions[type](state, action);
39
29
  };
40
30
 
41
- export const normalizeSpaces = (spaces: (Space | Space[] | undefined)[]): NormalizedSpace[] => {
42
- // if spaces coming in is array of an array of spaces objects,
43
- // then we matched by payerId and should unravel that first level of array
44
- let spacesToReduce = spaces;
45
- if (Array.isArray(spaces[0])) {
46
- spacesToReduce = spaces[0];
47
- }
48
- // Normalize space pairs ( [{ name: 'foo'', value: 'bar' }] => { foo: 'bar' } )
49
- const pairFields: PairFields = ['images', 'metadata', 'colors', 'icons', 'mapping'];
50
- return spacesToReduce.reduce((accum: NormalizedSpace[], spc: Space): NormalizedSpace[] => {
51
- if (!spc) return accum;
52
-
53
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
- const { images, metadata, colors, icons, mapping, ...rest } = spc;
55
- const normalizedSpace: NormalizedSpace = { ...rest };
56
-
57
- for (const field of pairFields) {
58
- if (spc[field] && Array.isArray(spc[field])) {
59
- normalizedSpace[field] = spc[field]?.reduce((_accum: NormalizedPairField, { name, value }: NameValuePair) => {
60
- _accum[name] = value;
61
- return _accum;
62
- }, {});
63
- }
64
- }
65
-
66
- accum.push(normalizedSpace);
67
- return accum;
68
- }, []);
69
- };
70
-
71
31
  export const fetchSpaces = async ({ query, clientId, variables }: FetchSpacesProps) => {
72
32
  // eslint-disable-next-line no-useless-catch
73
33
  const {
@@ -12,7 +12,13 @@ export type NameValuePair = {
12
12
  value: string;
13
13
  };
14
14
 
15
- export type PairFields = ('images' | 'metadata' | 'colors' | 'icons' | 'mapping')[];
15
+ export type SpacesImages = {
16
+ billboard?: string;
17
+ logo?: string;
18
+ promotional?: string;
19
+ promotionalHover?: string;
20
+ tile?: string;
21
+ };
16
22
 
17
23
  export type Space = {
18
24
  /** The name of the content or configuration. */
@@ -26,38 +32,30 @@ export type Space = {
26
32
  /** A list of payerIds for the configuration or content. */
27
33
  payerIDs?: string[];
28
34
  /** The images associated with the configuration. */
29
- images?: NameValuePair[];
35
+ images?: SpacesImages;
36
+ /** Metadata for a configuration */
37
+ meta?: Record<string, string>;
30
38
  /** Key-value data for a configuration. */
31
- metadata?: NameValuePair[];
39
+ metadataPairs?: NameValuePair[];
32
40
  /** The feature box colors associated with the Payer Space. */
33
- colors?: NameValuePair[];
41
+ colors?: Record<string, string>;
34
42
  /** Contains URL fragments that point to icons. */
35
- icons?: NameValuePair[];
43
+ icons?: Record<string, string>;
36
44
  /** The key-value mapping pairs. */
37
- mapping?: NameValuePair[];
38
- };
39
-
40
- export type NormalizedPairField = { [key: string]: string };
41
-
42
- export interface NormalizedSpace extends Omit<Space, 'images' | 'metadata' | 'colors' | 'icons' | 'mapping'> {
43
- /** The images associated with the configuration. */
44
- images?: NormalizedPairField;
45
- /** The feature box colors associated with the Payer Space. */
46
- colors?: NormalizedPairField;
47
- /** Contains URL fragments that point to icons. */
48
- icons?: NormalizedPairField;
49
- /** Key-value data for a configuration. */
50
- metadata?: NormalizedPairField;
51
- /** The key-value mapping pairs. */
52
- mapping?: NormalizedPairField;
53
- /** URL metadata for the configuration. */
45
+ mapping?: Record<string, string>;
46
+ mappingPairs?: NameValuePair[];
47
+ /** Whether or not the space is ghosted */
48
+ isGhost?: boolean;
54
49
  link?: {
55
50
  /** Contains a URL or URL Fragment that the hyperlink points to. */
56
51
  url: string;
57
52
  /** Specifies where to open the linked URL. */
58
53
  target: string;
59
54
  };
60
- }
55
+ /** The description of the configuration. */
56
+ description?: string;
57
+ url?: string;
58
+ };
61
59
 
62
60
  export type FetchSpacesProps = {
63
61
  /** The query sent to the avWebQL endpoint. */
@@ -109,7 +107,7 @@ export interface SpacesReducerAction extends SpacesContextType {
109
107
 
110
108
  export type ChildrenProps = {
111
109
  /** Array of spaces to be passed into the Spaces provider. */
112
- spaces: NormalizedSpace[];
110
+ spaces: Space[];
113
111
  };
114
112
 
115
113
  export type SpacesProps = {