@wix/auto-patterns 1.25.0 → 1.27.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 (118) hide show
  1. package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js +16 -7
  2. package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +2 -2
  4. package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  5. package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +58 -4
  6. package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
  7. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +10 -9
  8. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
  9. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +88 -36
  10. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
  11. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +19 -5
  12. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  13. package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +1 -1
  14. package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  15. package/dist/cjs/hooks/index.js +19 -0
  16. package/dist/cjs/hooks/index.js.map +1 -1
  17. package/dist/cjs/hooks/useEntityPageHeaderTexts.js +48 -9
  18. package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
  19. package/dist/cjs/hooks/useGridFeatures.js +3 -0
  20. package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
  21. package/dist/cjs/hooks/useNavigationUtils.js +21 -6
  22. package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
  23. package/dist/cjs/hooks/useTableFeatures.js +3 -0
  24. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  25. package/dist/cjs/hooks/useTableGridSwitchFeatures.js +3 -0
  26. package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
  27. package/dist/cjs/hooks/useUpdateAppContextItems.js +18 -0
  28. package/dist/cjs/hooks/useUpdateAppContextItems.js.map +1 -0
  29. package/dist/cjs/providers/AppContext.js +58 -0
  30. package/dist/cjs/providers/AppContext.js.map +1 -0
  31. package/dist/cjs/providers/ItemsContext.js +37 -0
  32. package/dist/cjs/providers/ItemsContext.js.map +1 -0
  33. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  34. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  35. package/dist/cjs/providers/index.js +12 -0
  36. package/dist/cjs/providers/index.js.map +1 -1
  37. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  38. package/dist/cjs/types/types.js.map +1 -1
  39. package/dist/docs/app_config_structure.md +6 -2
  40. package/dist/docs/auto-patterns-guide.md +466 -38
  41. package/dist/docs/bulk_actions.md +2 -5
  42. package/dist/docs/collection_page.md +1 -1
  43. package/dist/docs/collection_page_actions.md +4 -13
  44. package/dist/docs/custom_overrides.md +18 -6
  45. package/dist/docs/entity_page.md +294 -2
  46. package/dist/docs/entity_page_actions.md +3 -3
  47. package/dist/docs/entity_page_view_actions.md +2 -2
  48. package/dist/docs/index.md +12 -0
  49. package/dist/docs/installation.md +25 -2
  50. package/dist/docs/pages_configuration.md +2 -2
  51. package/dist/docs/resolved_action.md +106 -0
  52. package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js +5 -3
  53. package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
  54. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +2 -2
  55. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  56. package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +24 -0
  57. package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
  58. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +2 -1
  59. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
  60. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +45 -18
  61. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
  62. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +8 -0
  63. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  64. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +1 -1
  65. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  66. package/dist/esm/hooks/index.js +2 -0
  67. package/dist/esm/hooks/index.js.map +1 -1
  68. package/dist/esm/hooks/useEntityPageHeaderTexts.js +48 -9
  69. package/dist/esm/hooks/useEntityPageHeaderTexts.js.map +1 -1
  70. package/dist/esm/hooks/useGridFeatures.js +4 -1
  71. package/dist/esm/hooks/useGridFeatures.js.map +1 -1
  72. package/dist/esm/hooks/useNavigationUtils.js +21 -6
  73. package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
  74. package/dist/esm/hooks/useTableFeatures.js +4 -1
  75. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  76. package/dist/esm/hooks/useTableGridSwitchFeatures.js +4 -1
  77. package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
  78. package/dist/esm/hooks/useUpdateAppContextItems.js +13 -0
  79. package/dist/esm/hooks/useUpdateAppContextItems.js.map +1 -0
  80. package/dist/esm/providers/AppContext.js +31 -0
  81. package/dist/esm/providers/AppContext.js.map +1 -0
  82. package/dist/esm/providers/ItemsContext.js +23 -0
  83. package/dist/esm/providers/ItemsContext.js.map +1 -0
  84. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  85. package/dist/esm/providers/index.js +1 -0
  86. package/dist/esm/providers/index.js.map +1 -1
  87. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  88. package/dist/esm/types/types.js.map +1 -1
  89. package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts +1 -0
  90. package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts.map +1 -1
  91. package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
  92. package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts.map +1 -1
  93. package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts.map +1 -1
  94. package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
  95. package/dist/types/hooks/index.d.ts +2 -0
  96. package/dist/types/hooks/index.d.ts.map +1 -1
  97. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts +10 -1
  98. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  99. package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
  100. package/dist/types/hooks/useNavigationUtils.d.ts +5 -1
  101. package/dist/types/hooks/useNavigationUtils.d.ts.map +1 -1
  102. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  103. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
  104. package/dist/types/hooks/useUpdateAppContextItems.d.ts +2 -0
  105. package/dist/types/hooks/useUpdateAppContextItems.d.ts.map +1 -0
  106. package/dist/types/providers/AppContext.d.ts +11 -0
  107. package/dist/types/providers/AppContext.d.ts.map +1 -0
  108. package/dist/types/providers/ItemsContext.d.ts +11 -0
  109. package/dist/types/providers/ItemsContext.d.ts.map +1 -0
  110. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +10 -0
  111. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  112. package/dist/types/providers/index.d.ts +1 -0
  113. package/dist/types/providers/index.d.ts.map +1 -1
  114. package/dist/types/types/EntityPageConfig.d.ts +5 -1
  115. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  116. package/dist/types/types/types.d.ts +1 -0
  117. package/dist/types/types/types.d.ts.map +1 -1
  118. package/package.json +18 -18
@@ -174,11 +174,8 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
174
174
  - Be registered in the `actions` property of your `PatternsWizardOverridesProvider`
175
175
  - Follow JavaScript identifier naming rules (camelCase recommended)
176
176
 
177
- 2. The implementation must return an object with:
178
- - `label`: Text displayed for the action
179
- - `icon`: An Icon component from "@wix/wix-ui-icons-common"
180
- - `onClick`: Handler function for the bulk action
181
- - `hidden` (optional): Boolean to hide the action when true
177
+ 2. The implementation must return a `ResolvedAction`:
178
+ For complete field documentation, see [ResolvedAction Reference](./resolved_action.md).
182
179
 
183
180
  3. The implementation must:
184
181
  - Use the correct type: `CustomBulkActionsActionResolver`
@@ -1,6 +1,6 @@
1
1
  # Collection Page Configuration
2
2
 
3
- ## ⚠️ Collection Page Rules
3
+ ## Collection Page Rules
4
4
 
5
5
  - **Components array inside collectionPage must contain exactly one component with a layout array**
6
6
  - **All collection pages with tables/grids must reference their corresponding entity page via `entityPageId`** in the collection configuration
@@ -1,6 +1,6 @@
1
1
  # Collection Page Actions
2
2
 
3
- ## ⚠️ Required Actions
3
+ ## Required Actions
4
4
 
5
5
  - **Every collection page must include a create action that navigates to the entity page for adding new entities** - this is essential for user workflow
6
6
 
@@ -64,7 +64,7 @@ Custom collection page actions execute JavaScript code that you define for colle
64
64
  ```typescript
65
65
  import { CustomActionCollectionPageActionResolver } from '@wix/auto-patterns';
66
66
  import React from 'react';
67
- import { Download } from '@wix/ui-icons-common';
67
+ import { Download } from '@wix/wix-ui-icons-common';
68
68
 
69
69
  // IMPORTANT: Function name MUST match the action id in your configuration
70
70
  export const exportCollection: CustomActionCollectionPageActionResolver = (params) => {
@@ -184,16 +184,7 @@ Row click actions are configured at the table level using the `onRowClick` prope
184
184
 
185
185
  ⚠️ **CRITICAL**: When you configure `onRowClick` in your TypeScript configuration, you MUST provide a complete working implementation. The Auto Patterns framework cannot function without it.
186
186
 
187
- Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction` object with all required properties:
188
-
189
- #### Required Return Object Structure:
190
- ```typescript
191
- return {
192
- label: string, // REQUIRED: Action label
193
- icon: ReactElement, // REQUIRED: Icon component
194
- onClick: () => void // REQUIRED: Click handler function
195
- };
196
- ```
187
+ Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
197
188
 
198
189
  #### Complete Implementation Example:
199
190
 
@@ -353,7 +344,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
353
344
  - **MANDATORY IMPLEMENTATION**: If you configure `onRowClick` in TypeScript configuration, you MUST provide a complete working implementation - the framework cannot function without it
354
345
  - The action `id` in the configuration MUST exactly match the function name exported from your actions folder
355
346
  - The implementation must use the `CustomActionCollectionPageActionOnRowClickResolver` type
356
- - **Required Return Object**: Must return an object with `label`, `icon`, and `onClick` properties - all are required
347
+ - **Required Return Object**: Must return a `ResolvedAction` object - see [ResolvedAction Reference](./resolved_action.md)
357
348
  - Access the clicked item's data through `actionParams.item`
358
349
  - The implementation must be exported as a named export and registered in your `PatternsWizardOverridesProvider`
359
350
  - When `onRowClick` is configured, the default navigation to entity page is completely disabled
@@ -1,6 +1,6 @@
1
1
  # Custom Overrides
2
2
 
3
- ## ⚠️ Override Rules
3
+ ## Override Rules
4
4
 
5
5
  - **Custom overrides are restricted to the defined areas only** - attempting to override or modify any other aspect of `AutoPatternsApp` is prohibited and can cause unexpected behavior
6
6
  - **Always verify override implementation** - when implementing custom overrides, you MUST ensure they are correctly imported and passed to the `PatternsWizardOverridesProvider`
@@ -42,9 +42,15 @@ your-page/
42
42
  ├── customDataSources/ // Custom data sources
43
43
  │ ├── index.tsx // Exports useCustomDataSources hook
44
44
  │ └── myCustomDataSource.ts
45
- └── sections/ // Section renderers
46
- ├── index.tsx
47
- └── groupByType.ts
45
+ ├── sections/ // Section renderers
46
+ ├── index.tsx
47
+ └── groupByType.ts
48
+ ├── entityPageHeaderSubtitle/ // Entity page dynamic subtitle functions
49
+ │ ├── index.tsx // Exports useEntityPageHeaderSubtitle hook
50
+ │ └── mySubtitle.ts
51
+ └── entityPageHeaderBadges/ // Entity page dynamic badges functions
52
+ ├── index.tsx // Exports useEntityPageHeaderBadges hook
53
+ └── myBadges.ts
48
54
  ```
49
55
 
50
56
  ### Using Override Hooks in Your Page
@@ -59,6 +65,8 @@ import { useSections } from '../components/sections';
59
65
  import { useComponents } from '../components/customComponents';
60
66
  import { useModals } from '../components/modals';
61
67
  import { useCustomDataSources } from '../components/customDataSources';
68
+ import { useEntityPageHeaderSubtitle } from '../components/entityPageHeaderSubtitle';
69
+ import { useEntityPageHeaderBadges } from '../components/entityPageHeaderBadges';
62
70
 
63
71
  export default function YourPage() {
64
72
  const actions = useActions();
@@ -68,9 +76,11 @@ export default function YourPage() {
68
76
  const components = useComponents();
69
77
  const modals = useModals();
70
78
  const customDataSources = useCustomDataSources();
79
+ const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
80
+ const entityPageHeaderBadges = useEntityPageHeaderBadges();
71
81
 
72
82
  return (
73
- <PatternsWizardOverridesProvider value={{ actions, columns, slots, sections, components, modals, customDataSources }}>
83
+ <PatternsWizardOverridesProvider value={{ actions, columns, slots, sections, components, modals, customDataSources, entityPageHeaderSubtitle, entityPageHeaderBadges }}>
74
84
  <AutoPatternsApp configuration={config} />
75
85
  </PatternsWizardOverridesProvider>
76
86
  );
@@ -89,10 +99,12 @@ For example:
89
99
  - Adding a new section renderer → Update `../components/sections/index.tsx` to include the new section in the `useSections` hook
90
100
  - Adding a new custom component → Update `../components/customComponents/index.tsx` to include the new component in the `useComponents` hook
91
101
  - Adding a new custom data source → Update `../components/customDataSources/index.tsx` to include the new data source in the `useCustomDataSources` hook
102
+ - Adding a new subtitle override → Update `../components/entityPageHeaderSubtitle/index.tsx` to include the new subtitle in the `useEntityPageHeaderSubtitle` hook
103
+ - Adding a new badges override → Update `../components/entityPageHeaderBadges/index.tsx` to include the new badges in the `useEntityPageHeaderBadges` hook
92
104
 
93
105
  Without updating the hook index files, your implementations won't be available to the `PatternsWizardOverridesProvider`.
94
106
 
95
- ## ⚠️ Common Override Mistakes to Avoid
107
+ ## Common Override Mistakes to Avoid
96
108
 
97
109
  - Attempting to override unsupported areas
98
110
  - Invalid column rendering functions
@@ -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
@@ -55,7 +55,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
55
55
 
56
56
  return {
57
57
  label: 'My More Action',
58
- icon: <MyIcon />, // optional
58
+ icon: <MyIcon />, // required
59
59
  onClick: () => {
60
60
  // Your custom logic here
61
61
  },
@@ -75,7 +75,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
75
75
  - The implementation must use the `CustomEntityPageActionResolver` type.
76
76
  - The implementation must be exported as a named export (not default export).
77
77
  - The function receives `{ actionParams, sdk }` as parameters.
78
- - The returned object must include at least a `label` and an `onClick` handler (optionally an `icon`).
78
+ - The returned object must be a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete documentation.
79
79
 
80
80
  ---
81
81
 
@@ -86,7 +86,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
86
86
  ✓ Custom actions match implementations in overrides
87
87
  ✓ The resolver is exported and registered in the `actions` property of your `PatternsWizardOverridesProvider`
88
88
  ✓ The function signature matches `CustomEntityPageActionResolver`
89
- ✓ The returned object includes `label`, `onClick`, and optionally `icon`
89
+ ✓ The returned object is a `ResolvedAction` (see [ResolvedAction Reference](./resolved_action.md))
90
90
 
91
91
  ---
92
92
 
@@ -96,7 +96,7 @@ View mode actions follow the same resolver patterns as collection page actions:
96
96
  These actions are handled automatically by the AutoPatterns framework using the configuration provided.
97
97
 
98
98
  ### For Custom Actions
99
- Custom actions require resolver implementations:
99
+ Custom actions require resolver implementations that return a `ResolvedAction` object. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
100
100
 
101
101
  ```typescript
102
102
  import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
@@ -107,7 +107,7 @@ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
107
107
  const schema = sdk.getSchema(sdk.collectionId);
108
108
  return {
109
109
  label: 'Duplicate Product',
110
- icon: <DuplicateIcon />, // optional
110
+ icon: <DuplicateIcon />, // required
111
111
  onClick: async () => {
112
112
  // Your custom duplication logic here
113
113
  await schema.actions.create({
@@ -46,10 +46,22 @@ 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
52
60
 
61
+ ### ID: `resolved_action`
62
+ **Topics**: ResolvedAction interface, common return type for custom actions, field documentation
63
+ **Keywords**: ResolvedAction, action return type, custom action interface, action fields, label, icon, onClick, disabled, hidden, tooltip, skin
64
+
53
65
  ### ID: `installation`
54
66
  **Topics**: Package installation, setup process, component integration, provider setup
55
67
  **Keywords**: installation, setup, getting started, initial setup, package installation, dependencies, component integration, provider setup
@@ -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)
@@ -0,0 +1,106 @@
1
+ # ResolvedAction: Common Return Type for Custom Actions
2
+
3
+ All custom action resolvers in Auto Patterns must return a `ResolvedAction`. This applies to:
4
+ - Collection page actions (primary, secondary, menus) and `onRowClick`
5
+ - Entity page actions (view mode: primary/secondary/more; edit mode: moreActions)
6
+ - Bulk action toolbar actions
7
+ - Action Cell actions
8
+
9
+ ## Type Definition
10
+
11
+ From `@wix/auto-patterns`:
12
+
13
+ ```typescript
14
+ export interface ResolvedAction {
15
+ label: string;
16
+ icon: IconElement;
17
+ onClick: () => void;
18
+ disabled?: boolean;
19
+ hidden?: boolean;
20
+ tooltip?: string;
21
+ skin?: string;
22
+ }
23
+ ```
24
+
25
+ ## Field Reference
26
+
27
+ ### Required Fields
28
+
29
+ - **`label`** (string): Text displayed in the button or menu item.
30
+ - **`icon`** (IconElement): An icon component, typically from `@wix/wix-ui-icons-common`. Example: `icon: <Delete />`.
31
+ - **`onClick`** (function): Handler function invoked when the user triggers the action. Can be async.
32
+
33
+ ### Optional Fields
34
+
35
+ - **`disabled`** (boolean): When `true`, renders the action as disabled. Pair with `tooltip` to explain why the action is unavailable.
36
+ - **`hidden`** (boolean): When `true`, the action is completely omitted from the UI. Useful for permission-based or state-based visibility control.
37
+ - **`tooltip`** (string): Tooltip text displayed on hover. Especially useful when the action is disabled.
38
+ - **`skin`** (string): Visual style of the action button. Availability may vary by placement context. Recommended values:
39
+ - Primary actions: `"standard"`, `"inverted"`, `"premium"`
40
+ - Secondary/more/menu items: `"dark"`, `"destructive"`, `"premium"`
41
+ - If unsure, omit `skin` or use `"standard"` for primary actions and `"dark"` for secondary actions.
42
+
43
+ ## Examples
44
+
45
+ ### Minimal Example
46
+
47
+ ```typescript
48
+ import { Add } from '@wix/wix-ui-icons-common';
49
+
50
+ return {
51
+ label: 'Create',
52
+ icon: <Add />,
53
+ onClick: () => {
54
+ // Your action logic here
55
+ }
56
+ };
57
+ ```
58
+
59
+ ### Complete Example with State Control
60
+
61
+ ```typescript
62
+ import { Download } from '@wix/wix-ui-icons-common';
63
+
64
+ return {
65
+ label: 'Export',
66
+ icon: <Download />,
67
+ onClick: async () => {
68
+ try {
69
+ // Perform export logic using SDK
70
+ await performExport();
71
+ } catch (error) {
72
+ // Handle errors, show toast, etc.
73
+ }
74
+ },
75
+ disabled: total === 0,
76
+ tooltip: total === 0 ? 'Select at least one item to export' : undefined,
77
+ hidden: !userHasExportPermission,
78
+ skin: 'premium'
79
+ };
80
+ ```
81
+
82
+ ## Context-Specific Notes
83
+
84
+ ### Collection Page Actions
85
+ - **onRowClick**: Access clicked item data via `actionParams.item`
86
+ - **Collection-level actions**: Access collection context via `actionParams.collectionId`
87
+
88
+ ### Entity Page Actions
89
+ - **View/Edit mode**: Access entity data via `actionParams.entity`
90
+ - **Edit mode only**: Access form instance via `actionParams.form`
91
+
92
+ ### Bulk Actions
93
+ - **Selection data**: Use `actionParams.selectedValues` and `actionParams.total`
94
+ - **State control**: Commonly use `disabled: selectedValues.length === 0`
95
+
96
+ ### Action Cell Actions
97
+ - **Row context**: Access item and position via `actionParams.item` and `actionParams.index`
98
+
99
+ ## See Also
100
+
101
+ - [Collection Page Actions](./collection_page_actions.md)
102
+ - [Entity Page Actions](./entity_page_actions.md) (edit mode)
103
+ - [Entity Page View Actions](./entity_page_view_actions.md)
104
+ - [Bulk Actions Toolbar](./bulk_actions.md)
105
+ - [Action Cell](./action_cell.md)
106
+ - [App Config Structure](./app_config_structure.md) (action item `skin` property)