@wix/auto-patterns 1.18.0 → 1.20.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 (62) hide show
  1. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +4 -2
  2. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  3. package/dist/cjs/hooks/useTableFeatures.js +9 -1
  4. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  5. package/dist/cjs/providers/ErrorContext.js +64 -0
  6. package/dist/cjs/providers/ErrorContext.js.map +1 -0
  7. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  8. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  9. package/dist/cjs/providers/RootAppProvider.js +16 -8
  10. package/dist/cjs/providers/RootAppProvider.js.map +1 -1
  11. package/dist/cjs/providers/SchemaContext.js +7 -2
  12. package/dist/cjs/providers/SchemaContext.js.map +1 -1
  13. package/dist/cjs/providers/index.js +6 -0
  14. package/dist/cjs/providers/index.js.map +1 -1
  15. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  16. package/dist/cjs/types/actions/collectionPageActions.js.map +1 -1
  17. package/dist/cjs/types/types.js.map +1 -1
  18. package/dist/docs/action_cell.md +21 -8
  19. package/dist/docs/app_config_structure.md +10 -3
  20. package/dist/docs/auto-patterns-guide.md +425 -120
  21. package/dist/docs/bulk_actions.md +20 -7
  22. package/dist/docs/collection_page_actions.md +45 -19
  23. package/dist/docs/custom_overrides.md +318 -71
  24. package/dist/docs/entity_page.md +0 -1
  25. package/dist/docs/index.md +1 -1
  26. package/dist/docs/installation.md +8 -9
  27. package/dist/docs/introduction.md +3 -2
  28. package/dist/docs/wix_fqdn_custom_data_source.md +111 -54
  29. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +4 -2
  30. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  31. package/dist/esm/hooks/useTableFeatures.js +10 -2
  32. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  33. package/dist/esm/providers/ErrorContext.js +44 -0
  34. package/dist/esm/providers/ErrorContext.js.map +1 -0
  35. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  36. package/dist/esm/providers/RootAppProvider.js +2 -1
  37. package/dist/esm/providers/RootAppProvider.js.map +1 -1
  38. package/dist/esm/providers/SchemaContext.js +6 -1
  39. package/dist/esm/providers/SchemaContext.js.map +1 -1
  40. package/dist/esm/providers/index.js +1 -0
  41. package/dist/esm/providers/index.js.map +1 -1
  42. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  43. package/dist/esm/types/actions/collectionPageActions.js.map +1 -1
  44. package/dist/esm/types/types.js.map +1 -1
  45. package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
  46. package/dist/types/hooks/useTableFeatures.d.ts +6 -0
  47. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  48. package/dist/types/providers/ErrorContext.d.ts +11 -0
  49. package/dist/types/providers/ErrorContext.d.ts.map +1 -0
  50. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -0
  51. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  52. package/dist/types/providers/RootAppProvider.d.ts.map +1 -1
  53. package/dist/types/providers/SchemaContext.d.ts.map +1 -1
  54. package/dist/types/providers/index.d.ts +1 -0
  55. package/dist/types/providers/index.d.ts.map +1 -1
  56. package/dist/types/types/CollectionPageConfig.d.ts +3 -0
  57. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  58. package/dist/types/types/actions/collectionPageActions.d.ts +7 -0
  59. package/dist/types/types/actions/collectionPageActions.d.ts.map +1 -1
  60. package/dist/types/types/types.d.ts +1 -5
  61. package/dist/types/types/types.d.ts.map +1 -1
  62. package/package.json +9 -9
@@ -59,7 +59,7 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
59
59
  ├── page.tsx
60
60
  └── components/
61
61
  └── actions/
62
- ├── index.tsx // Exports all actions
62
+ ├── index.tsx // Exports useActions hook
63
63
  └── bulkExportPets.tsx // Your custom bulk action
64
64
  ```
65
65
 
@@ -121,10 +121,17 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
121
121
 
122
122
  3. Export your action in `actions/index.tsx`:
123
123
  ```typescript
124
- export * from './bulkExportPets';
124
+ import { bulkExportPets } from './bulkExportPets';
125
+
126
+ export const useActions = () => {
127
+ // You can access React context and other hooks here
128
+ return {
129
+ bulkExportPets
130
+ };
131
+ };
125
132
  ```
126
133
 
127
- 4. Configure the action in your JSON configuration:
134
+ 4. Configure the action in your TypeScript configuration:
128
135
  ```json
129
136
  {
130
137
  "id": "bulkExportPets", // MUST match the function name exactly
@@ -135,11 +142,17 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
135
142
 
136
143
  5. Register your action in the `PatternsWizardOverridesProvider`:
137
144
  ```typescript
138
- import * as actions from './components/actions';
145
+ import { useActions } from '../components/actions';
146
+
147
+ export default function YourPage() {
148
+ const actions = useActions();
139
149
 
140
- <PatternsWizardOverridesProvider value={{ actions }}>
141
- <AutoPatternsApp configuration={config as AppConfig} />
142
- </PatternsWizardOverridesProvider>
150
+ return (
151
+ <PatternsWizardOverridesProvider value={{ actions }}>
152
+ <AutoPatternsApp configuration={config} />
153
+ </PatternsWizardOverridesProvider>
154
+ );
155
+ }
143
156
  ```
144
157
 
145
158
  ### Key Points for Custom Bulk Actions:
@@ -56,7 +56,7 @@ Custom collection page actions execute JavaScript code that you define for colle
56
56
  ├── page.tsx
57
57
  └── components/
58
58
  └── actions/
59
- ├── index.tsx // Exports all actions
59
+ ├── index.tsx // Exports useActions hook
60
60
  └── exportCollection.tsx // Your custom collection action
61
61
  ```
62
62
 
@@ -103,10 +103,17 @@ Custom collection page actions execute JavaScript code that you define for colle
103
103
 
104
104
  3. Export your action in `actions/index.tsx`:
105
105
  ```typescript
106
- export * from './exportCollection';
106
+ import { exportCollection } from './exportCollection';
107
+
108
+ export const useActions = () => {
109
+ // You can access React context and other hooks here
110
+ return {
111
+ exportCollection
112
+ };
113
+ };
107
114
  ```
108
115
 
109
- 4. Configure the action in your JSON configuration:
116
+ 4. Configure the action in your TypeScript configuration:
110
117
  ```json
111
118
  {
112
119
  "id": "exportCollection", // MUST match the function name exactly
@@ -121,11 +128,17 @@ Custom collection page actions execute JavaScript code that you define for colle
121
128
 
122
129
  5. Register your action in the `PatternsWizardOverridesProvider`:
123
130
  ```typescript
124
- import * as actions from './components/actions';
131
+ import { useActions } from '../components/actions';
125
132
 
126
- <PatternsWizardOverridesProvider value={{ actions }}>
127
- <AutoPatternsApp configuration={config as AppConfig} />
128
- </PatternsWizardOverridesProvider>
133
+ export default function YourPage() {
134
+ const actions = useActions();
135
+
136
+ return (
137
+ <PatternsWizardOverridesProvider value={{ actions }}>
138
+ <AutoPatternsApp configuration={config} />
139
+ </PatternsWizardOverridesProvider>
140
+ );
141
+ }
129
142
  ```
130
143
 
131
144
  ## Key Points for Custom Collection Page Actions:
@@ -165,7 +178,7 @@ Row click actions are configured at the table level using the `onRowClick` prope
165
178
 
166
179
  ### Implementation Requirements
167
180
 
168
- ⚠️ **CRITICAL**: When you configure `onRowClick` in your JSON, you MUST provide a complete working implementation. The Auto Patterns framework cannot function without it.
181
+ ⚠️ **CRITICAL**: When you configure `onRowClick` in your TypeScript configuration, you MUST provide a complete working implementation. The Auto Patterns framework cannot function without it.
169
182
 
170
183
  Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction` object with all required properties:
171
184
 
@@ -243,7 +256,18 @@ export const openSidePanel: CustomActionCollectionPageActionOnRowClickResolver =
243
256
  };
244
257
  ```
245
258
 
246
- **Step 2: Configure in JSON**:
259
+ **Step 2: Export your action in `actions/index.tsx`**:
260
+ ```typescript
261
+ import { openSidePanel } from './openSidePanel';
262
+
263
+ export const useActions = () => {
264
+ return {
265
+ openSidePanel
266
+ };
267
+ };
268
+ ```
269
+
270
+ **Step 3: Configure in TypeScript**:
247
271
  ```json
248
272
  {
249
273
  "type": "Table",
@@ -257,17 +281,19 @@ export const openSidePanel: CustomActionCollectionPageActionOnRowClickResolver =
257
281
  }
258
282
  ```
259
283
 
260
- **Step 3: Export and Register**:
284
+ **Step 4: Register in `PatternsWizardOverridesProvider`**:
261
285
  ```typescript
262
- // components/actions/index.tsx
263
- export * from './openSidePanel';
286
+ import { useActions } from '../components/actions';
264
287
 
265
- // page.tsx
266
- import * as actions from './components/actions';
288
+ export default function YourPage() {
289
+ const actions = useActions();
267
290
 
268
- <PatternsWizardOverridesProvider value={{ actions }}>
269
- <AutoPatternsApp configuration={config as AppConfig} />
270
- </PatternsWizardOverridesProvider>
291
+ return (
292
+ <PatternsWizardOverridesProvider value={{ actions }}>
293
+ <AutoPatternsApp configuration={config} />
294
+ </PatternsWizardOverridesProvider>
295
+ );
296
+ }
271
297
  ```
272
298
 
273
299
  #### 2. Direct Data Manipulation
@@ -314,7 +340,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
314
340
  - You can still navigate to the entity page programmatically if needed using the SDK navigation utilities
315
341
 
316
342
  ### Key Points for Custom Row Click Actions:
317
- - **MANDATORY IMPLEMENTATION**: If you configure `onRowClick` in JSON, you MUST provide a complete working implementation - the framework cannot function without it
343
+ - **MANDATORY IMPLEMENTATION**: If you configure `onRowClick` in TypeScript configuration, you MUST provide a complete working implementation - the framework cannot function without it
318
344
  - The action `id` in the configuration MUST exactly match the function name exported from your actions folder
319
345
  - The implementation must use the `CustomActionCollectionPageActionOnRowClickResolver` type
320
346
  - **Required Return Object**: Must return an object with `label`, `icon`, and `onClick` properties - all are required
@@ -330,7 +356,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
330
356
  ✓ `primaryActions` and `secondaryActions` (if defined) have a valid `type` ("action" or "menu").
331
357
  ✓ If `type: "action"`, `action.item` is a valid action item configuration.
332
358
  ✓ If `type: "menu"`, `menu.items` is an array of valid action item configurations that can include dividers.
333
- ✓ Each action item contains a unique `id`, and the full `collection` object (`collectionId`, `entityTypeSource: 'cms'`).
359
+ ✓ Each action item contains a unique `id`, and the full `collection` object (`collectionId`, `entityTypeSource`).
334
360
  ✓ Each action item has a supported `type` (`create`, `custom`) and its corresponding configuration block (e.g., `create` block for `type: "create"`).
335
361
  ✓ `create` actions specify a `create.page.id` that matches an existing `entityPage` ID in the configuration.
336
362
  ✓ `custom` actions (identified by their main `id`) correspond to an action resolver function name registered in the `actions` override.