@wix/auto-patterns 1.25.0 → 1.26.0

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 (35) hide show
  1. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +10 -9
  2. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +88 -36
  4. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
  5. package/dist/cjs/hooks/useEntityPageHeaderTexts.js +48 -9
  6. package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
  7. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  8. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  9. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  10. package/dist/docs/app_config_structure.md +6 -2
  11. package/dist/docs/auto-patterns-guide.md +347 -16
  12. package/dist/docs/collection_page.md +1 -1
  13. package/dist/docs/collection_page_actions.md +1 -1
  14. package/dist/docs/custom_overrides.md +18 -6
  15. package/dist/docs/entity_page.md +294 -2
  16. package/dist/docs/index.md +8 -0
  17. package/dist/docs/installation.md +25 -2
  18. package/dist/docs/pages_configuration.md +2 -2
  19. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +2 -1
  20. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
  21. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +45 -18
  22. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
  23. package/dist/esm/hooks/useEntityPageHeaderTexts.js +48 -9
  24. package/dist/esm/hooks/useEntityPageHeaderTexts.js.map +1 -1
  25. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  26. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  27. package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts.map +1 -1
  28. package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts.map +1 -1
  29. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts +10 -1
  30. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  31. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +10 -0
  32. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  33. package/dist/types/types/EntityPageConfig.d.ts +5 -1
  34. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  35. package/package.json +11 -11
@@ -1,6 +1,6 @@
1
1
  # Entity Page Configuration
2
2
 
3
- ## ⚠️ Entity Page Requirements
3
+ ## Entity Page Requirements
4
4
 
5
5
  All entity pages must have:
6
6
  - **A route path with descriptive segment and dynamic parameter** (e.g., `/product/:entityId`, `/pet/:entityId`) - **never just `/:entityId`** as this conflicts with collection page routing
@@ -12,6 +12,20 @@ All entity pages must have:
12
12
  * Displays details for a **single entity**.
13
13
  * Always tied to a single Wix collection.
14
14
  * Supports **two distinct modes**: **view mode** and **edit mode** with separate page configurations.
15
+ * Supports **dynamic subtitle** that adapt based on entity data (see [Entity Page Dynamic Subtitle](#entity-page-dynamic-subtitle)).
16
+ * Supports **dynamic badges** in the page title that adapt based on entity data (see [Entity Page Dynamic Badges](#entity-page-dynamic-badges)).
17
+
18
+ ## 🏷️ **Understanding Badges Requests**
19
+
20
+ When a user asks to "add badges to the entity page", understand that they want:
21
+
22
+ 1. **Custom component overrides** - NOT direct configuration in JSON
23
+ 2. **Function that returns badge objects** - NOT JSX components
24
+ 3. **Badge properties** like `text`, `skin`, `prefixIcon`, etc.
25
+ 4. **Registration in PatternsWizardOverridesProvider** under `entityPageHeaderBadges`
26
+
27
+ **Example Request**: "Add 2 badges with random skins and text 'wow'"
28
+ **Correct Implementation**: Create a function that returns `[{text: 'wow', skin: 'success'}, {text: 'wow', skin: 'premium'}]`
15
29
 
16
30
  ## Entity Page Modes
17
31
 
@@ -40,6 +54,284 @@ This pattern allows:
40
54
  - Clear distinction between view and edit URLs
41
55
  - Natural navigation flow between modes
42
56
 
57
+ ## Entity Page Dynamic Subtitle
58
+
59
+ Entity pages support dynamic subtitles that adapt based on entity data, providing contextual information below the main title.
60
+
61
+ ### Configuration
62
+
63
+ Add an `id` property to the entity page subtitle configuration:
64
+
65
+ ```json
66
+ {
67
+ "subtitle": {
68
+ "text": "Default subtitle text",
69
+ "id": "mySubtitleOverride"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ### Subtitle Override Implementation
75
+
76
+ Create a subtitle override function that returns an object with a `text` property:
77
+
78
+ ```typescript
79
+ const mySubtitleOverride = (entity: Record<string, any>): { text: string } => {
80
+ return { text: `Pet: ${entity.name || 'Unknown'}` };
81
+ };
82
+ ```
83
+
84
+ ### Complete Implementation Guide
85
+
86
+ #### Step 1: Create the Subtitle Function
87
+
88
+ **File**: `src/dashboard/components/entityPageHeaderSubtitle/entityPageHeaderSubtitle.ts`
89
+
90
+ ```typescript
91
+ export const entityPageHeaderSubtitle = (entity: Record<string, any>): { text: string } => {
92
+ return { text: `Pet: ${entity.name || 'Unknown'}` };
93
+ };
94
+ ```
95
+
96
+ #### Step 2: Create/Update Index File
97
+
98
+ **File**: `src/dashboard/components/entityPageHeaderSubtitle/index.ts`
99
+
100
+ ```typescript
101
+ import { entityPageHeaderSubtitle } from './entityPageHeaderSubtitle';
102
+
103
+ export const useEntityPageHeaderSubtitle = () => {
104
+ return entityPageHeaderSubtitle;
105
+ };
106
+ ```
107
+
108
+ #### Step 3: Update Main Page Overrides
109
+
110
+ **File**: `src/dashboard/pages/page.tsx`
111
+
112
+ ```typescript
113
+ import { useEntityPageHeaderSubtitle } from '../components/entityPageHeaderSubtitle';
114
+
115
+ const Index: FC = () => {
116
+ const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
117
+
118
+ return (
119
+ <PatternsWizardOverridesProvider
120
+ value={{
121
+ // ... other overrides
122
+ entityPageHeaderSubtitle: {
123
+ entityPageHeaderSubtitle,
124
+ },
125
+ }}
126
+ >
127
+ <WixPetsPage />
128
+ </PatternsWizardOverridesProvider>
129
+ );
130
+ };
131
+ ```
132
+
133
+ #### Step 4: Update Configuration
134
+
135
+ **File**: `src/dashboard/pages/wixPetsConfig.patterns.ts`
136
+
137
+ ```typescript
138
+ {
139
+ id: 'wixPets-entity',
140
+ type: 'entityPage',
141
+ entityPage: {
142
+ subtitle: {
143
+ text: 'Default subtitle text',
144
+ id: 'entityPageHeaderSubtitle', // ⚠️ CRITICAL: This must match the override key
145
+ },
146
+ // ... rest of config
147
+ },
148
+ }
149
+ ```
150
+
151
+ ### Required File Structure
152
+
153
+ ```
154
+ src/dashboard/
155
+ ├── components/
156
+ │ └── entityPageHeaderSubtitle/
157
+ │ ├── index.ts # ✅ MUST EXIST (hook exports)
158
+ │ └── entityPageHeaderSubtitle.ts # ✅ MUST EXIST (subtitle function)
159
+ ├── pages/
160
+ │ ├── page.tsx # ✅ MUST REGISTER OVERRIDES
161
+ │ └── wixPetsConfig.patterns.ts # ✅ MUST HAVE SUBTITLE CONFIG
162
+ ```
163
+
164
+
165
+ **Example**:
166
+ ```typescript
167
+ // Config
168
+ subtitle: { id: 'mySubtitleOverride' }
169
+
170
+ // Overrides
171
+ entityPageHeaderSubtitle: { mySubtitleOverride: myFunction }
172
+
173
+ // Function
174
+ export const myFunction = (entity) => { ... }
175
+ ```
176
+
177
+ ### Integration
178
+
179
+ Register your subtitle override in the `PatternsWizardOverridesProvider`:
180
+
181
+ ```typescript
182
+ <PatternsWizardOverridesProvider value={{
183
+ entityPageHeaderSubtitle: {
184
+ mySubtitleOverride,
185
+ },
186
+ }}>
187
+ <AutoPatternsApp configuration={config} />
188
+ </PatternsWizardOverridesProvider>
189
+ ```
190
+
191
+ ## Entity Page Dynamic Badges
192
+
193
+ Entity pages support dynamic badges in the page title that display contextual information about the entity.
194
+
195
+
196
+ ### Badge Skin Options
197
+
198
+ The `skin` property accepts values from the `BadgeSkin` type of `@wix/design-system`:
199
+
200
+ ### Badge Properties
201
+
202
+ Each badge can have the following properties:
203
+
204
+ ```typescript
205
+ {
206
+ text: string; // Required: Text to display
207
+ skin?: BadgeSkin; // Optional: Visual styling
208
+ prefixIcon?: React.ReactElement; // Optional: Icon before text (from @wix/wix-ui-icons-common)
209
+ suffixIcon?: React.ReactElement; // Optional: Icon after text (from @wix/wix-ui-icons-common)
210
+ }
211
+ ```
212
+
213
+
214
+ ## ⚠️ **CRITICAL: Understanding Badges Implementation**
215
+
216
+ When implementing badges for entity pages, understand these key points:
217
+
218
+ 1. **Badges are CUSTOM COMPONENT OVERRIDES** - NOT direct configuration
219
+ 2. **Badge function returns an ARRAY of badge objects** - NOT JSX components
220
+ 3. **Each badge object has properties** like `text`, `skin`, `prefixIcon`, etc.
221
+ 4. **Must be registered in PatternsWizardOverridesProvider** under `entityPageHeaderBadges`
222
+
223
+ ### Complete Implementation Guide
224
+
225
+ #### Step 1: Create the Badge Function
226
+
227
+ **File**: `src/dashboard/components/entityPageHeaderBadges/entityPageHeaderBadges.ts`
228
+
229
+ ```typescript
230
+ export const entityPageHeaderBadges = (entity: Record<string, any>) => {
231
+ // Define available badge skins
232
+ const badgeSkins = ['success', 'warning', 'destructive', 'neutral', 'premium'] as const;
233
+
234
+ // Get random skins for the two badges
235
+ const randomSkin1 = badgeSkins[Math.floor(Math.random() * badgeSkins.length)];
236
+ const randomSkin2 = badgeSkins[Math.floor(Math.random() * badgeSkins.length)];
237
+
238
+ return [
239
+ {
240
+ text: 'wow',
241
+ skin: randomSkin1,
242
+ },
243
+ {
244
+ text: 'wow',
245
+ skin: randomSkin2,
246
+ },
247
+ ];
248
+ };
249
+ ```
250
+
251
+ #### Step 2: Create/Update Index File
252
+
253
+ **File**: `src/dashboard/components/entityPageHeaderBadges/index.ts`
254
+
255
+ ```typescript
256
+ import { entityPageHeaderBadges } from './entityPageHeaderBadges';
257
+
258
+ export const useEntityPageHeaderBadges = () => {
259
+ return entityPageHeaderBadges;
260
+ };
261
+ ```
262
+
263
+ #### Step 3: Update Main Page Overrides
264
+
265
+ **File**: `src/dashboard/pages/page.tsx`
266
+
267
+ ```typescript
268
+ import { useEntityPageHeaderSubtitle } from '../components/entityPageHeaderSubtitle';
269
+ import { useEntityPageHeaderBadges } from '../components/entityPageHeaderBadges';
270
+
271
+ const Index: FC = () => {
272
+ const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
273
+ const entityPageHeaderBadges = useEntityPageHeaderBadges();
274
+
275
+ return (
276
+ <PatternsWizardOverridesProvider
277
+ value={{
278
+ // ... other overrides
279
+ entityPageHeaderSubtitle: {
280
+ entityPageHeaderSubtitle,
281
+ },
282
+ entityPageHeaderBadges: {
283
+ entityPageHeaderBadges, // ⚠️ CRITICAL: This must match the ID in config
284
+ },
285
+ }}
286
+ >
287
+ <WixPetsPage />
288
+ </PatternsWizardOverridesProvider>
289
+ );
290
+ };
291
+ ```
292
+
293
+ #### Step 4: Update Configuration
294
+
295
+ **File**: `src/dashboard/pages/wixPetsConfig.patterns.ts`
296
+
297
+ ```typescript
298
+ {
299
+ id: 'wixPets-entity',
300
+ type: 'entityPage',
301
+ entityPage: {
302
+ title: {
303
+ text: 'WixPet Details',
304
+ badges: {
305
+ id: 'entityPageHeaderBadges', // ⚠️ CRITICAL: This must match the override key
306
+ },
307
+ },
308
+ // ... rest of config
309
+ },
310
+ }
311
+ ```
312
+
313
+ ### Required File Structure
314
+
315
+ ```
316
+ src/dashboard/
317
+ ├── components/
318
+ │ └── entityPageHeaderBadges/
319
+ │ ├── index.ts # ✅ MUST EXIST (badges hook exports)
320
+ │ └── entityPageHeaderBadges.ts # ✅ MUST EXIST (badges function)
321
+ ├── pages/
322
+ │ ├── page.tsx # ✅ MUST REGISTER OVERRIDES
323
+ │ └── wixPetsConfig.patterns.ts # ✅ MUST HAVE BADGES CONFIG
324
+ ```
325
+
326
+ ### ⚠️ **Common Badges Mistakes to Avoid**
327
+
328
+ 1. **❌ DON'T return JSX components** - Return badge objects instead
329
+ 2. **❌ DON'T use direct configuration** - Use custom component overrides
330
+ 3. **❌ DON'T forget to register in PatternsWizardOverridesProvider**
331
+ 5. **❌ DON'T forget to export from index.ts** - Must export the function
332
+
333
+
334
+
43
335
  ## View Mode: Purpose and API
44
336
 
45
337
  ### Purpose of View Mode
@@ -155,7 +447,7 @@ Entity page action configuration depends on the mode:
155
447
  - For image fields, consider providing more space (larger span)
156
448
  - Images are automatically rendered with proper controls when using the field type
157
449
 
158
- ## ⚠️ Common Entity Page Layout Mistakes to Avoid
450
+ ## Common Entity Page Layout Mistakes to Avoid
159
451
 
160
452
  - Using incorrect span values causing unexpected layout breaks
161
453
  - Referencing non-existent field IDs in the layout
@@ -46,6 +46,14 @@ This index maps user requests to the appropriate section IDs for fetching releva
46
46
  **Topics**: Entity page edit mode actions, moreActions, custom entity actions
47
47
  **Keywords**: entity page actions, edit mode actions, moreActions, custom entity actions, entity-specific operations, action menus
48
48
 
49
+ ### ID: `entity_page_badges`
50
+ **Topics**: Entity page badges, dynamic badges, badge configuration, badge overrides
51
+ **Keywords**: badges, entity page badges, dynamic badges, badge configuration, badge overrides, title badges, header badges, badge skins, badge text, badge icons
52
+
53
+ ### ID: `entity_page_subtitle`
54
+ **Topics**: Entity page dynamic subtitle, subtitle overrides, dynamic text generation
55
+ **Keywords**: subtitle, entity page subtitle, dynamic subtitle, subtitle overrides, header subtitle, title subtitle, dynamic text, contextual subtitle, entity-based subtitle
56
+
49
57
  ### ID: `entity_page_view_actions`
50
58
  **Topics**: Entity page view mode actions, primaryActions, secondaryActions, collection-style actions
51
59
  **Keywords**: view mode actions, primaryActions, secondaryActions, read-only entity actions, entity page view operations, collection-style entity actions, navigation actions
@@ -2,13 +2,36 @@
2
2
 
3
3
  ## 1. Install Packages
4
4
 
5
- Install if necessary and doesn't exists in package.json:
5
+ Install if doesn't exists in package.json:
6
6
 
7
7
  ```bash
8
8
  npm install @wix/auto-patterns @wix/patterns @wix/design-system
9
9
  ```
10
10
 
11
- ## ⚠️ Critical Import Rules
11
+ ### React Router dependency
12
+
13
+ `react-router-dom` is required. Install a version that matches your React version:
14
+
15
+ - React 16.x (and 17.x): use `react-router-dom@^6`
16
+ - React 18+ : use `react-router-dom@^7`
17
+
18
+ Check your React version:
19
+
20
+ ```bash
21
+ npm ls react --depth=0
22
+ ```
23
+
24
+ Then install the matching router version:
25
+
26
+ ```bash
27
+ # For React 16.x or 17.x
28
+ npm install react-router-dom@^6
29
+
30
+ # For React 18+
31
+ npm install react-router-dom@^7
32
+ ```
33
+
34
+ ## Critical Import Rules
12
35
 
13
36
  - **Import `AutoPatternsApp` only from `@wix/auto-patterns`** - never from other packages
14
37
  - **CRITICAL:** Always import `AppConfig` as a type import: `import type { AppConfig } from '@wix/auto-patterns/types'` - never import it as a value import
@@ -1,6 +1,6 @@
1
1
  # Pages Configuration
2
2
 
3
- ## ⚠️ Critical Page Rules
3
+ ## Critical Page Rules
4
4
 
5
5
  - **Pages array must contain exactly two pages** - one collectionPage and one entityPage
6
6
  - **Exactly one page must have `appMainPage: true`** to designate it as the main page
@@ -81,7 +81,7 @@ A two-way connection must be established between collection pages and entity pag
81
81
  * **Route Structure**: Entity pages must use `/[segment]/:entityId` format (e.g., `/product/:entityId` or `/pets/:entityId`), never just `/:entityId`
82
82
  * **Route Parameters Configuration**: All entity pages must have both a dynamic parameter in `route.path` and a matching configuration in `route.params`
83
83
 
84
- ## ⚠️ Common Route and Configuration Mistakes to Avoid
84
+ ## Common Route and Configuration Mistakes to Avoid
85
85
 
86
86
  - Missing route.params for entity pages
87
87
  - Using `/:entityId` instead of `/segment/:entityId` for entity page routes (causes routing conflicts)
@@ -81,7 +81,8 @@ export const EditModeEntityPage = _ref => {
81
81
  } = useEntityPageHeaderTexts({
82
82
  config: configuration,
83
83
  isCreateMode,
84
- entityDisplayName: entity == null ? void 0 : entity[schema.displayField]
84
+ entityDisplayName: entity == null ? void 0 : entity[schema.displayField],
85
+ entity
85
86
  });
86
87
  const sdk = useActionsSDK({
87
88
  collectionId
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMemo","useRef","EntityPage","useEntity","useEntityPage","MoreActions","useForm","useParams","useSchema","useEntityPageHeaderTexts","useNavigation","useEntityPageMoreActions","useActionsSDK","RenderLayoutCard","EditModeEntityPage","_ref","_pageLayout$main","_pageLayout$sidebar","configuration","layout","pageLayout","parentPageId","route","actions","collectionId","moreActions","form","mode","params","entityId","id","schema","isCreateMode","inputRefs","setInputRef","input","current","validate","invalidFieldId","Object","keys","find","fieldId","_inputRefs$current$fi","invalid","_inputRefs$current$in","focus","Error","getParentPagePath","parentPath","state","onSave","formValues","getValues","baseEntity","entity","updatedEntity","newEntity","update","create","fetch","undefined","get","title","subtitle","config","entityDisplayName","displayField","sdk","resolvedMoreActions","createElement","dataHook","Header","length","items","Content","MainContent","main","map","layoutIndex","key","sectionId","cardIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/EditModeEntityPage.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport {\n EntityPage,\n EntityPageState,\n useEntity,\n useEntityPage,\n MoreActions,\n} from '@wix/patterns';\nimport { useForm } from '@wix/patterns/form';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers/SchemaContext';\nimport { BaseInputRef } from './Fields/types';\nimport { useEntityPageHeaderTexts, useNavigation } from '../../hooks';\nimport { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';\nimport { useActionsSDK } from '../../hooks/useActionsSDK';\nimport { RenderLayoutCard } from './RenderLayout';\nimport { EditEntityPageConfig } from '../../types';\n\nexport const EditModeEntityPage: React.FC<{\n configuration: EditEntityPageConfig;\n}> = ({ configuration }) => {\n const {\n layout: pageLayout,\n parentPageId,\n route,\n actions,\n collectionId,\n } = configuration;\n\n const moreActions = actions?.moreActions;\n\n const form = useForm<any>({\n mode: 'onChange',\n });\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const isCreateMode = !entityId;\n\n const inputRefs = useRef<{ [fieldId: string]: BaseInputRef }>({});\n\n const setInputRef = (id: string, input: BaseInputRef) => {\n inputRefs.current[id] = input;\n };\n\n const validate = () => {\n const invalidFieldId = Object.keys(inputRefs.current).find((fieldId) => {\n return inputRefs.current[fieldId]?.invalid;\n });\n\n if (invalidFieldId) {\n inputRefs.current[invalidFieldId]?.focus?.();\n throw new Error('Invalid form');\n }\n };\n const { getParentPagePath } = useNavigation();\n\n const parentPath = useMemo(\n () => getParentPagePath(parentPageId),\n [parentPageId, getParentPagePath],\n );\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath,\n form,\n onSave: async () => {\n validate();\n\n const formValues = form.getValues();\n const baseEntity = state.entity || {};\n const updatedEntity = {\n ...baseEntity,\n ...formValues,\n };\n\n const newEntity = entityId\n ? await schema.actions.update(updatedEntity)\n : await schema.actions.create(updatedEntity);\n\n return { updatedEntity: newEntity };\n },\n fetch: async () => {\n if (!entityId) {\n return { entity: undefined };\n }\n const entity = await schema.actions.get(entityId);\n return { entity };\n },\n });\n\n const entity = useEntity(state);\n\n const { title, subtitle } = useEntityPageHeaderTexts({\n config: configuration,\n isCreateMode,\n entityDisplayName: entity?.[schema.displayField],\n });\n\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const resolvedMoreActions = useEntityPageMoreActions(\n moreActions,\n entity,\n sdk,\n form,\n );\n\n return (\n <EntityPage state={state} dataHook=\"auto-patterns-entity-page\">\n <EntityPage.Header\n title={title}\n subtitle={subtitle}\n moreActions={\n resolvedMoreActions.length > 0 ? (\n <MoreActions items={resolvedMoreActions} />\n ) : undefined\n }\n />\n <EntityPage.Content>\n <EntityPage.MainContent dataHook=\"entity-page-main-content\">\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.MainContent>\n {pageLayout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC9C,SACEC,UAAU,EAEVC,SAAS,EACTC,aAAa,EACbC,WAAW,QACN,eAAe;AACtB,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,+BAA+B;AAEzD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,aAAa;AACrE,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,gBAAgB,QAAQ,gBAAgB;AAGjD,OAAO,MAAMC,kBAEX,GAAGC,IAAA,IAAuB;EAAA,IAAAC,gBAAA,EAAAC,mBAAA;EAAA,IAAtB;IAAEC;EAAc,CAAC,GAAAH,IAAA;EACrB,MAAM;IACJI,MAAM,EAAEC,UAAU;IAClBC,YAAY;IACZC,KAAK;IACLC,OAAO;IACPC;EACF,CAAC,GAAGN,aAAa;EAEjB,MAAMO,WAAW,GAAGF,OAAO,oBAAPA,OAAO,CAAEE,WAAW;EAExC,MAAMC,IAAI,GAAGpB,OAAO,CAAM;IACxBqB,IAAI,EAAE;EACR,CAAC,CAAC;EACF,MAAMC,MAAM,GAAGrB,SAAS,CAAC,CAAC;EAC1B,MAAMsB,QAAQ,GAAGD,MAAM,CAACN,KAAK,CAACM,MAAM,CAACE,EAAE,CAAC;EACxC,MAAMC,MAAM,GAAGvB,SAAS,CAAC,CAAC;EAC1B,MAAMwB,YAAY,GAAG,CAACH,QAAQ;EAE9B,MAAMI,SAA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CAAC,eACF9D,KAAA,CAAAuE,aAAA,CAACpE,UAAU,CAACyE,OAAO,qBACjB5E,KAAA,CAAAuE,aAAA,CAACpE,UAAU,CAAC0E,WAAW;IAACL,QAAQ,EAAC;EAA0B,GACxDnD,UAAU,aAAAJ,gBAAA,GAAVI,UAAU,CAAEyD,IAAI,qBAAhB7D,gBAAA,CAAkB8D,GAAG,CAAC,CAAC3D,MAAM,EAAE4D,WAAW,kBACzChF,KAAA,CAAAuE,aAAA,CAACzD,gBAAgB;IACfmE,GAAG,EAAE,qBAAqBD,WAAW,EAAG;IACxC5D,MAAM,EAAEA,MAAO;IACf8D,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAEH,WAAY;IACvB7C,WAAW,EAAEA;EAAY,CAC1B,CACF,CACqB,CAAC,EACxBd,UAAU,YAAVA,UAAU,CAAE+D,OAAO,gBAClBpF,KAAA,CAAAuE,aAAA,CAACpE,UAAU,CAACkF,iBAAiB,SAAAnE,mBAAA,GAC1BG,UAAU,CAAC+D,OAAO,qBAAlBlE,mBAAA,CAAoB6D,GAAG,CAAC,CAAC3D,MAAM,EAAE4D,WAAW,kBAC3ChF,KAAA,CAAAuE,aAAA,CAACzD,gBAAgB;IACfmE,GAAG,EAAE,wBAAwBD,WAAW,EAAG;IAC3C5D,MAAM,EAAEA,MAAO;IACf8D,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEH,WAAY;IACvB7C,WAAW,EAAEA;EAAY,CAC1B,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CAAC;AAEjB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","useRef","EntityPage","useEntity","useEntityPage","MoreActions","useForm","useParams","useSchema","useEntityPageHeaderTexts","useNavigation","useEntityPageMoreActions","useActionsSDK","RenderLayoutCard","EditModeEntityPage","_ref","_pageLayout$main","_pageLayout$sidebar","configuration","layout","pageLayout","parentPageId","route","actions","collectionId","moreActions","form","mode","params","entityId","id","schema","isCreateMode","inputRefs","setInputRef","input","current","validate","invalidFieldId","Object","keys","find","fieldId","_inputRefs$current$fi","invalid","_inputRefs$current$in","focus","Error","getParentPagePath","parentPath","state","onSave","formValues","getValues","baseEntity","entity","updatedEntity","newEntity","update","create","fetch","undefined","get","title","subtitle","config","entityDisplayName","displayField","sdk","resolvedMoreActions","createElement","dataHook","Header","length","items","Content","MainContent","main","map","layoutIndex","key","sectionId","cardIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/EditModeEntityPage.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport {\n EntityPage,\n EntityPageState,\n useEntity,\n useEntityPage,\n MoreActions,\n} from '@wix/patterns';\nimport { useForm } from '@wix/patterns/form';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers/SchemaContext';\nimport { BaseInputRef } from './Fields/types';\nimport { useEntityPageHeaderTexts, useNavigation } from '../../hooks';\nimport { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';\nimport { useActionsSDK } from '../../hooks/useActionsSDK';\nimport { RenderLayoutCard } from './RenderLayout';\nimport { EditEntityPageConfig } from '../../types';\n\nexport const EditModeEntityPage: React.FC<{\n configuration: EditEntityPageConfig;\n}> = ({ configuration }) => {\n const {\n layout: pageLayout,\n parentPageId,\n route,\n actions,\n collectionId,\n } = configuration;\n\n const moreActions = actions?.moreActions;\n\n const form = useForm<any>({\n mode: 'onChange',\n });\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const isCreateMode = !entityId;\n\n const inputRefs = useRef<{ [fieldId: string]: BaseInputRef }>({});\n\n const setInputRef = (id: string, input: BaseInputRef) => {\n inputRefs.current[id] = input;\n };\n\n const validate = () => {\n const invalidFieldId = Object.keys(inputRefs.current).find((fieldId) => {\n return inputRefs.current[fieldId]?.invalid;\n });\n\n if (invalidFieldId) {\n inputRefs.current[invalidFieldId]?.focus?.();\n throw new Error('Invalid form');\n }\n };\n const { getParentPagePath } = useNavigation();\n\n const parentPath = useMemo(\n () => getParentPagePath(parentPageId),\n [parentPageId, getParentPagePath],\n );\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath,\n form,\n onSave: async () => {\n validate();\n\n const formValues = form.getValues();\n const baseEntity = state.entity || {};\n const updatedEntity = {\n ...baseEntity,\n ...formValues,\n };\n\n const newEntity = entityId\n ? await schema.actions.update(updatedEntity)\n : await schema.actions.create(updatedEntity);\n\n return { updatedEntity: newEntity };\n },\n fetch: async () => {\n if (!entityId) {\n return { entity: undefined };\n }\n const entity = await schema.actions.get(entityId);\n return { entity };\n },\n });\n\n const entity = useEntity(state);\n\n const { title, subtitle } = useEntityPageHeaderTexts({\n config: configuration,\n isCreateMode,\n entityDisplayName: entity?.[schema.displayField],\n entity,\n });\n\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const resolvedMoreActions = useEntityPageMoreActions(\n moreActions,\n entity,\n sdk,\n form,\n );\n\n return (\n <EntityPage state={state} dataHook=\"auto-patterns-entity-page\">\n <EntityPage.Header\n title={title}\n subtitle={subtitle}\n moreActions={\n resolvedMoreActions.length > 0 ? (\n <MoreActions items={resolvedMoreActions} />\n ) : undefined\n }\n />\n <EntityPage.Content>\n <EntityPage.MainContent dataHook=\"entity-page-main-content\">\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.MainContent>\n {pageLayout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAA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,CAAAuE,aAAA,CAACzD,gBAAgB;IACfmE,GAAG,EAAE,qBAAqBD,WAAW,EAAG;IACxC5D,MAAM,EAAEA,MAAO;IACf8D,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAEH,WAAY;IACvB7C,WAAW,EAAEA;EAAY,CAC1B,CACF,CACqB,CAAC,EACxBd,UAAU,YAAVA,UAAU,CAAE+D,OAAO,gBAClBpF,KAAA,CAAAuE,aAAA,CAACpE,UAAU,CAACkF,iBAAiB,SAAAnE,mBAAA,GAC1BG,UAAU,CAAC+D,OAAO,qBAAlBlE,mBAAA,CAAoB6D,GAAG,CAAC,CAAC3D,MAAM,EAAE4D,WAAW,kBAC3ChF,KAAA,CAAAuE,aAAA,CAACzD,gBAAgB;IACfmE,GAAG,EAAE,wBAAwBD,WAAW,EAAG;IAC3C5D,MAAM,EAAEA,MAAO;IACf8D,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEH,WAAY;IACvB7C,WAAW,EAAEA;EAAY,CAC1B,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CAAC;AAEjB,CAAC","ignoreList":[]}
@@ -1,17 +1,20 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
2
- import { Box, Cell, Heading, Layout, Page } from '@wix/design-system';
3
- import { RenderViewLayoutCard } from './ViewEntityPage/RenderViewLayoutCard';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useState, useEffect } from 'react';
3
+ import { Page, Heading, Box, Layout, Cell, Badge } from '@wix/design-system';
4
4
  import { useParams } from 'react-router-dom';
5
- import { useSchema } from '../../providers';
6
- import { useNavigation } from '../../hooks/useNavigationUtils';
5
+ import { RenderViewLayoutCard } from './ViewEntityPage/RenderViewLayoutCard';
6
+ import { useSchema } from '../../providers/SchemaContext';
7
+ import { useNavigation } from '../../hooks';
7
8
  import { MoreActions } from '@wix/patterns';
8
9
  import { useEntityPageActions } from '../../hooks/useEntityPageActions';
9
10
  import { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';
10
11
  import { useActionsSDK } from '../../hooks/useActionsSDK';
11
12
  import { useNavigateEditEntityAction } from '../../hooks/useNavigateEditEntityAction';
13
+ import { useEntityPageHeaderTexts } from '../../hooks/useEntityPageHeaderTexts';
14
+ import { SkeletonEntity } from './SkeletonEntity';
12
15
  // TODO: temp solution until we have a proper view mode entity page
13
16
  export const ViewModeEntityPage = _ref => {
14
- var _configuration$subtit, _pageLayout$main, _pageLayout$sidebar;
17
+ var _pageLayout$main, _pageLayout$sidebar;
15
18
  let {
16
19
  configuration
17
20
  } = _ref;
@@ -45,14 +48,16 @@ export const ViewModeEntityPage = _ref => {
45
48
  isMounted = false;
46
49
  };
47
50
  }, [entityId, schema]);
48
- const title = useMemo(() => {
49
- if (configuration.title) {
50
- return configuration.title.text;
51
- } else {
52
- return (entity == null ? void 0 : entity[schema.displayField]) ?? 'View Item';
53
- }
54
- }, [configuration.title, entity, schema.displayField]);
55
- const subtitle = (_configuration$subtit = configuration.subtitle) == null ? void 0 : _configuration$subtit.text;
51
+ const {
52
+ title,
53
+ subtitle
54
+ } = useEntityPageHeaderTexts({
55
+ config: configuration,
56
+ isCreateMode: false,
57
+ isViewMode: true,
58
+ entityDisplayName: entity == null ? void 0 : entity[schema.displayField],
59
+ entity
60
+ });
56
61
  const sdk = useActionsSDK({
57
62
  collectionId: configuration.collectionId
58
63
  });
@@ -68,14 +73,36 @@ export const ViewModeEntityPage = _ref => {
68
73
  configuration
69
74
  });
70
75
  const resolvedMoreActions = useEntityPageMoreActions(moreActions, entity, sdk);
76
+ const renderTitle = () => {
77
+ const {
78
+ text,
79
+ badges
80
+ } = title;
81
+ return /*#__PURE__*/React.createElement(Box, {
82
+ gap: "SP2",
83
+ verticalAlign: "middle",
84
+ alignContent: "center"
85
+ }, /*#__PURE__*/React.createElement(Heading, {
86
+ size: "extraLarge"
87
+ }, text), badges && badges.length > 0 && /*#__PURE__*/React.createElement(Box, {
88
+ gap: "SP2"
89
+ }, badges.map((badge, index) => /*#__PURE__*/React.createElement(Badge, _extends({
90
+ key: index
91
+ }, badge, {
92
+ dataHook: `form-page-header-badge-${index}`
93
+ }), badge.text))));
94
+ };
95
+ if (!entity) {
96
+ return /*#__PURE__*/React.createElement(SkeletonEntity, {
97
+ entityPage: configuration
98
+ });
99
+ }
71
100
  return /*#__PURE__*/React.createElement(Page, {
72
101
  dataHook: "view-mode-entity-page"
73
102
  }, /*#__PURE__*/React.createElement(Page.Header, {
74
103
  dataHook: "view-mode-entity-page-header",
75
- title: /*#__PURE__*/React.createElement(Heading, {
76
- size: "extraLarge"
77
- }, title),
78
- subtitle: subtitle,
104
+ title: renderTitle(),
105
+ subtitle: subtitle == null ? void 0 : subtitle.text,
79
106
  showBackButton: true,
80
107
  onBackClicked: () => navigateToCollectionPage(configuration.parentPageId),
81
108
  actionsBar: /*#__PURE__*/React.createElement(Box, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useMemo","useState","Box","Cell","Heading","Layout","Page","RenderViewLayoutCard","useParams","useSchema","useNavigation","MoreActions","useEntityPageActions","useEntityPageMoreActions","useActionsSDK","useNavigateEditEntityAction","ViewModeEntityPage","_ref","_configuration$subtit","_pageLayout$main","_pageLayout$sidebar","configuration","route","params","entityId","id","schema","layout","pageLayout","navigateToCollectionPage","entity","setEntity","undefined","isMounted","fetchEntity","fetchedEntity","actions","get","title","text","displayField","subtitle","sdk","collectionId","entityPageActions","moreActions","displayName","resolvedMoreActions","createElement","dataHook","Header","size","showBackButton","onBackClicked","parentPageId","actionsBar","gap","length","items","Content","span","sidebar","direction","main","map","layoutIndex","key","sectionId","cardIndex"],"sources":["../../../../src/components/AutoPatternsEntityPage/ViewModeEntityPage.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { ViewEntityPageConfig } from '../../types';\nimport { Box, Cell, Heading, Layout, Page } from '@wix/design-system';\nimport { RenderViewLayoutCard } from './ViewEntityPage/RenderViewLayoutCard';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers';\nimport { useNavigation } from '../../hooks/useNavigationUtils';\nimport { MoreActions } from '@wix/patterns';\nimport { useEntityPageActions } from '../../hooks/useEntityPageActions';\nimport { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';\nimport { useActionsSDK } from '../../hooks/useActionsSDK';\nimport { useNavigateEditEntityAction } from '../../hooks/useNavigateEditEntityAction';\n\ninterface ViewModeEntityPageProps {\n configuration: ViewEntityPageConfig;\n}\n\n// TODO: temp solution until we have a proper view mode entity page\nexport const ViewModeEntityPage: React.FC<ViewModeEntityPageProps> = ({\n configuration,\n}) => {\n const { route } = configuration;\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const { layout: pageLayout } = configuration;\n const { navigateToCollectionPage } = useNavigation();\n\n const [entity, setEntity] = useState<any>(undefined);\n\n useEffect(() => {\n let isMounted = true;\n const fetchEntity = async () => {\n if (!entityId) {\n setEntity(undefined);\n return;\n }\n const fetchedEntity = await schema.actions.get(entityId);\n if (isMounted) {\n setEntity(fetchedEntity);\n }\n };\n fetchEntity();\n return () => {\n isMounted = false;\n };\n }, [entityId, schema]);\n\n const title = useMemo(() => {\n if (configuration.title) {\n return configuration.title.text;\n } else {\n return entity?.[schema.displayField] ?? 'View Item';\n }\n }, [configuration.title, entity, schema.displayField]);\n\n const subtitle = configuration.subtitle?.text;\n\n const sdk = useActionsSDK({\n collectionId: configuration.collectionId,\n });\n\n const actions = useEntityPageActions({\n entityPageActions: configuration.actions,\n entity,\n sdk,\n });\n\n // add OOTB navigate to edit action\n const moreActions = useNavigateEditEntityAction({\n displayName: entity?.[schema.displayField],\n configuration,\n });\n\n const resolvedMoreActions = useEntityPageMoreActions(\n moreActions,\n entity,\n sdk,\n );\n\n return (\n <Page dataHook=\"view-mode-entity-page\">\n <Page.Header\n dataHook=\"view-mode-entity-page-header\"\n title={<Heading size=\"extraLarge\">{title}</Heading>}\n subtitle={subtitle}\n showBackButton\n onBackClicked={() =>\n navigateToCollectionPage(configuration.parentPageId!)\n }\n actionsBar={\n <Box gap=\"SP2\">\n {resolvedMoreActions.length > 0 ? (\n <MoreActions\n dataHook=\"view-mode-entity-page-more-actions\"\n items={resolvedMoreActions}\n />\n ) : undefined}\n {actions}\n </Box>\n }\n />\n <Page.Content>\n <Layout>\n <Cell span={pageLayout?.sidebar ? 8 : 12}>\n <Box direction=\"vertical\" gap=\"SP4\">\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderViewLayoutCard\n key={`main-section-card-${layoutIndex}`}\n entity={entity}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </Box>\n </Cell>\n {pageLayout?.sidebar ? (\n <Cell span={4}>\n <Box direction=\"vertical\" gap=\"SP4\">\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderViewLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n entity={entity}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </Box>\n </Cell>\n ) : null}\n </Layout>\n </Page.Content>\n </Page>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAE3D,SAASC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,QAAQ,oBAAoB;AACrE,SAASC,oBAAoB,QAAQ,uCAAuC;AAC5E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,oBAAoB,QAAQ,kCAAkC;AACvE,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,2BAA2B,QAAQ,yCAAyC;AAMrF;AACA,OAAO,MAAMC,kBAAqD,GAAGC,IAAA,IAE/D;EAAA,IAAAC,qBAAA,EAAAC,g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;AAEX,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","useEffect","Page","Heading","Box","Layout","Cell","Badge","useParams","RenderViewLayoutCard","useSchema","useNavigation","MoreActions","useEntityPageActions","useEntityPageMoreActions","useActionsSDK","useNavigateEditEntityAction","useEntityPageHeaderTexts","SkeletonEntity","ViewModeEntityPage","_ref","_pageLayout$main","_pageLayout$sidebar","configuration","route","params","entityId","id","schema","layout","pageLayout","navigateToCollectionPage","entity","setEntity","undefined","isMounted","fetchEntity","fetchedEntity","actions","get","title","subtitle","config","isCreateMode","isViewMode","entityDisplayName","displayField","sdk","collectionId","entityPageActions","moreActions","displayName","resolvedMoreActions","renderTitle","text","badges","createElement","gap","verticalAlign","alignContent","size","length","map","badge","index","_extends","key","dataHook","entityPage","Header","showBackButton","onBackClicked","parentPageId","actionsBar","items","Content","span","sidebar","direction","main","layoutIndex","sectionId","cardIndex"],"sources":["../../../../src/components/AutoPatternsEntityPage/ViewModeEntityPage.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { Page, Heading, Box, Layout, Cell, Badge } from '@wix/design-system';\nimport { useParams } from 'react-router-dom';\nimport { RenderViewLayoutCard } from './ViewEntityPage/RenderViewLayoutCard';\nimport { useSchema } from '../../providers/SchemaContext';\nimport { useNavigation } from '../../hooks';\nimport { MoreActions } from '@wix/patterns';\nimport { useEntityPageActions } from '../../hooks/useEntityPageActions';\nimport { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';\nimport { useActionsSDK } from '../../hooks/useActionsSDK';\nimport { useNavigateEditEntityAction } from '../../hooks/useNavigateEditEntityAction';\nimport { useEntityPageHeaderTexts } from '../../hooks/useEntityPageHeaderTexts';\nimport { ViewEntityPageConfig } from '../../types';\nimport { SkeletonEntity } from './SkeletonEntity';\n\ninterface ViewModeEntityPageProps {\n configuration: ViewEntityPageConfig;\n}\n\n// TODO: temp solution until we have a proper view mode entity page\nexport const ViewModeEntityPage: React.FC<ViewModeEntityPageProps> = ({\n configuration,\n}) => {\n const { route } = configuration;\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const { layout: pageLayout } = configuration;\n const { navigateToCollectionPage } = useNavigation();\n\n const [entity, setEntity] = useState<any>(undefined);\n\n useEffect(() => {\n let isMounted = true;\n const fetchEntity = async () => {\n if (!entityId) {\n setEntity(undefined);\n return;\n }\n const fetchedEntity = await schema.actions.get(entityId);\n if (isMounted) {\n setEntity(fetchedEntity);\n }\n };\n fetchEntity();\n return () => {\n isMounted = false;\n };\n }, [entityId, schema]);\n\n const { title, subtitle } = useEntityPageHeaderTexts({\n config: configuration,\n isCreateMode: false,\n isViewMode: true,\n entityDisplayName: entity?.[schema.displayField],\n entity,\n });\n\n const sdk = useActionsSDK({\n collectionId: configuration.collectionId,\n });\n\n const actions = useEntityPageActions({\n entityPageActions: configuration.actions,\n entity,\n sdk,\n });\n\n // add OOTB navigate to edit action\n const moreActions = useNavigateEditEntityAction({\n displayName: entity?.[schema.displayField],\n configuration,\n });\n\n const resolvedMoreActions = useEntityPageMoreActions(\n moreActions,\n entity,\n sdk,\n );\n\n const renderTitle = () => {\n const { text, badges } = title;\n\n return (\n <Box gap=\"SP2\" verticalAlign=\"middle\" alignContent=\"center\">\n <Heading size=\"extraLarge\">{text}</Heading>\n {badges && badges.length > 0 && (\n <Box gap=\"SP2\">\n {badges.map((badge, index) => (\n <Badge\n key={index}\n {...badge}\n dataHook={`form-page-header-badge-${index}`}\n >\n {badge.text}\n </Badge>\n ))}\n </Box>\n )}\n </Box>\n );\n };\n\n if (!entity) {\n return <SkeletonEntity entityPage={configuration} />;\n }\n return (\n <Page dataHook=\"view-mode-entity-page\">\n <Page.Header\n dataHook=\"view-mode-entity-page-header\"\n title={renderTitle()}\n subtitle={subtitle?.text}\n showBackButton\n onBackClicked={() =>\n navigateToCollectionPage(configuration.parentPageId!)\n }\n actionsBar={\n <Box gap=\"SP2\">\n {resolvedMoreActions.length > 0 ? (\n <MoreActions\n dataHook=\"view-mode-entity-page-more-actions\"\n items={resolvedMoreActions}\n />\n ) : undefined}\n {actions}\n </Box>\n }\n />\n <Page.Content>\n <Layout>\n <Cell span={pageLayout?.sidebar ? 8 : 12}>\n <Box direction=\"vertical\" gap=\"SP4\">\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderViewLayoutCard\n key={`main-section-card-${layoutIndex}`}\n entity={entity}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </Box>\n </Cell>\n {pageLayout?.sidebar ? (\n <Cell span={4}>\n <Box direction=\"vertical\" gap=\"SP4\">\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderViewLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n entity={entity}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </Box>\n </Cell>\n ) : null}\n </Layout>\n </Page.Content>\n </Page>\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,SAASC,IAAI,EAAEC,OAAO,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,QAAQ,oBAAoB;AAC5E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,oBAAoB,QAAQ,uCAAuC;AAC5E,SAASC,SAAS,QAAQ,+BAA+B;AACzD,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,oBAAoB,QAAQ,kCAAkC;AACvE,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,2BAA2B,QAAQ,yCAAyC;AACrF,SAASC,wBAAwB,QAAQ,sCAAsC;AAE/E,SAASC,cAAc,QAAQ,kBAAkB;AAMjD;AACA,OAAO,MAAMC,kBAAqD,GAAGC,IAAA,IAE/D;EAAA,IAAAC,gBAAA,EAAAC,mBAAA;EAAA,IAFgE;IACpEC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