@wix/auto-patterns 1.27.0 → 1.29.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.
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +19 -58
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +48 -0
- package/dist/cjs/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +11 -7
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/cjs/components/ModalRenderer.js +1 -1
- package/dist/cjs/components/ModalRenderer.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +5 -0
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js +1 -1
- package/dist/cjs/dataSourceAdapters/cms/fetchCmsData.js.map +1 -1
- package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js +13 -6
- package/dist/cjs/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
- package/dist/cjs/hooks/useBaseCollectionParams.js +38 -0
- package/dist/cjs/hooks/useBaseCollectionParams.js.map +1 -0
- package/dist/cjs/hooks/useBaseSDK.js +1 -1
- package/dist/cjs/hooks/useBaseSDK.js.map +1 -1
- package/dist/cjs/hooks/useColumns.js +1 -1
- package/dist/cjs/hooks/useColumns.js.map +1 -1
- package/dist/cjs/hooks/useCommonCollectionFeatures.js +13 -6
- package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -1
- package/dist/cjs/hooks/useEmptyStates.js +1 -1
- package/dist/cjs/hooks/useEmptyStates.js.map +1 -1
- package/dist/cjs/hooks/useEntityPageHeaderTexts.js +2 -2
- package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
- package/dist/cjs/hooks/useFetchData.js +4 -5
- package/dist/cjs/hooks/useFetchData.js.map +1 -1
- package/dist/cjs/hooks/useFilters.js +2 -2
- package/dist/cjs/hooks/useFilters.js.map +1 -1
- package/dist/cjs/hooks/useGridFeatures.js +6 -26
- package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableFeatures.js +8 -28
- package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js +8 -28
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/cjs/providers/{PatternsWizardOverridesContext.js → AutoPatternsOverridesContext.js} +14 -11
- package/dist/cjs/providers/AutoPatternsOverridesContext.js.map +1 -0
- package/dist/cjs/providers/SchemaContext.js +24 -7
- package/dist/cjs/providers/SchemaContext.js.map +1 -1
- package/dist/cjs/providers/index.js +4 -4
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/types/BaseSDK.js.map +1 -1
- package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
- package/dist/cjs/types/actions/base.js.map +1 -1
- package/dist/cjs/types/fetchData.js +4 -0
- package/dist/cjs/types/fetchData.js.map +1 -0
- package/dist/cjs/types/index.js +6 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/types.js.map +1 -1
- package/dist/cjs/utils/actions/resolveAction.js +2 -1
- package/dist/cjs/utils/actions/resolveAction.js.map +1 -1
- package/dist/cjs/utils/actions/types.js.map +1 -1
- package/dist/cjs/utils/vibe.js +11 -0
- package/dist/cjs/utils/vibe.js.map +1 -0
- package/dist/docs/action_cell.md +18 -8
- package/dist/docs/app_config_structure.md +37 -1
- package/dist/docs/app_context.md +45 -0
- package/dist/docs/auto-patterns-guide.md +331 -82
- package/dist/docs/bulk_actions.md +10 -5
- package/dist/docs/collection_page.md +1 -1
- package/dist/docs/collection_page_actions.md +16 -9
- package/dist/docs/custom_overrides.md +22 -36
- package/dist/docs/entity_page.md +10 -10
- package/dist/docs/entity_page_actions.md +11 -4
- package/dist/docs/error_handling.md +135 -0
- package/dist/docs/index.md +8 -0
- package/dist/docs/installation.md +3 -3
- package/dist/docs/resolved_action.md +6 -2
- package/dist/docs/schema_config.md +11 -3
- package/dist/docs/wix_fqdn_custom_data_source.md +51 -9
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +2 -25
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -2
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js +29 -0
- package/dist/esm/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +2 -2
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +2 -2
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +5 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/esm/components/ModalRenderer.js +2 -2
- package/dist/esm/components/ModalRenderer.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +4 -0
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js +1 -1
- package/dist/esm/dataSourceAdapters/cms/fetchCmsData.js.map +1 -1
- package/dist/esm/hooks/useAutoPatternsOptimisticActions.js +14 -9
- package/dist/esm/hooks/useAutoPatternsOptimisticActions.js.map +1 -1
- package/dist/esm/hooks/useBaseCollectionParams.js +37 -0
- package/dist/esm/hooks/useBaseCollectionParams.js.map +1 -0
- package/dist/esm/hooks/useBaseSDK.js +2 -2
- package/dist/esm/hooks/useBaseSDK.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +2 -2
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/hooks/useCommonCollectionFeatures.js +9 -2
- package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
- package/dist/esm/hooks/useEmptyStates.js +2 -2
- package/dist/esm/hooks/useEmptyStates.js.map +1 -1
- package/dist/esm/hooks/useEntityPageHeaderTexts.js +2 -2
- package/dist/esm/hooks/useEntityPageHeaderTexts.js.map +1 -1
- package/dist/esm/hooks/useFetchData.js +2 -2
- package/dist/esm/hooks/useFetchData.js.map +1 -1
- package/dist/esm/hooks/useFilters.js +2 -2
- package/dist/esm/hooks/useFilters.js.map +1 -1
- package/dist/esm/hooks/useGridFeatures.js +6 -29
- package/dist/esm/hooks/useGridFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +8 -31
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js +8 -31
- package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/esm/providers/AutoPatternsOverridesContext.js +19 -0
- package/dist/esm/providers/AutoPatternsOverridesContext.js.map +1 -0
- package/dist/esm/providers/SchemaContext.js +23 -6
- package/dist/esm/providers/SchemaContext.js.map +1 -1
- package/dist/esm/providers/index.js +1 -1
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/types/BaseSDK.js.map +1 -1
- package/dist/esm/types/CollectionPageConfig.js.map +1 -1
- package/dist/esm/types/actions/base.js.map +1 -1
- package/dist/esm/types/fetchData.js +2 -0
- package/dist/esm/types/fetchData.js.map +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/types.js.map +1 -1
- package/dist/esm/utils/actions/resolveAction.js +2 -1
- package/dist/esm/utils/actions/resolveAction.js.map +1 -1
- package/dist/esm/utils/actions/types.js.map +1 -1
- package/dist/esm/utils/vibe.js +6 -0
- package/dist/esm/utils/vibe.js.map +1 -0
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts +3 -0
- package/dist/types/components/AutoPatternsCollectionPageFooter/AutoPatternsCollectionPageFooter.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts +2 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
- package/dist/types/hooks/useAutoPatternsOptimisticActions.d.ts +7 -1
- package/dist/types/hooks/useAutoPatternsOptimisticActions.d.ts.map +1 -1
- package/dist/types/hooks/useBaseCollectionParams.d.ts +27 -0
- package/dist/types/hooks/useBaseCollectionParams.d.ts.map +1 -0
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts +4 -3
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
- package/dist/types/hooks/useFetchData.d.ts +3 -13
- package/dist/types/hooks/useFetchData.d.ts.map +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
- package/dist/types/providers/{PatternsWizardOverridesContext.d.ts → AutoPatternsOverridesContext.d.ts} +14 -5
- package/dist/types/providers/AutoPatternsOverridesContext.d.ts.map +1 -0
- package/dist/types/providers/SchemaContext.d.ts.map +1 -1
- package/dist/types/providers/index.d.ts +1 -1
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/types/BaseSDK.d.ts +2 -2
- package/dist/types/types/BaseSDK.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +4 -0
- package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
- package/dist/types/types/actions/base.d.ts +1 -0
- package/dist/types/types/actions/base.d.ts.map +1 -1
- package/dist/types/types/fetchData.d.ts +21 -0
- package/dist/types/types/fetchData.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/types.d.ts +12 -7
- package/dist/types/types/types.d.ts.map +1 -1
- package/dist/types/utils/actions/resolveAction.d.ts +1 -0
- package/dist/types/utils/actions/resolveAction.d.ts.map +1 -1
- package/dist/types/utils/actions/types.d.ts +1 -0
- package/dist/types/utils/actions/types.d.ts.map +1 -1
- package/dist/types/utils/vibe.d.ts +2 -0
- package/dist/types/utils/vibe.d.ts.map +1 -0
- package/package.json +10 -10
- package/dist/cjs/dataSourceAdapters/factory.js +0 -14
- package/dist/cjs/dataSourceAdapters/factory.js.map +0 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +0 -1
- package/dist/esm/dataSourceAdapters/factory.js +0 -10
- package/dist/esm/dataSourceAdapters/factory.js.map +0 -1
- package/dist/esm/providers/PatternsWizardOverridesContext.js +0 -15
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +0 -1
- package/dist/types/dataSourceAdapters/factory.d.ts +0 -3
- package/dist/types/dataSourceAdapters/factory.d.ts.map +0 -1
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +0 -1
|
@@ -119,6 +119,7 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
119
119
|
})
|
|
120
120
|
});
|
|
121
121
|
},
|
|
122
|
+
biName: 'bulk-export-pets-action' // MANDATORY: For analytics tracking
|
|
122
123
|
};
|
|
123
124
|
};
|
|
124
125
|
```
|
|
@@ -141,10 +142,11 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
141
142
|
"id": "bulkExportPets", // MUST match the function name exactly
|
|
142
143
|
"type": "custom", // REQUIRED: Must be exactly "custom"
|
|
143
144
|
"label": "Export Selected", // Optional: Displayed text
|
|
145
|
+
"biName": "bulk-export-pets-action" // MANDATORY: Analytics tracking identifier
|
|
144
146
|
}
|
|
145
147
|
```
|
|
146
148
|
|
|
147
|
-
5. Register your action in the `
|
|
149
|
+
5. Register your action in the `AutoPatternsOverridesProvider`:
|
|
148
150
|
```typescript
|
|
149
151
|
import { useActions } from '../components/actions';
|
|
150
152
|
|
|
@@ -152,9 +154,9 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
152
154
|
const actions = useActions();
|
|
153
155
|
|
|
154
156
|
return (
|
|
155
|
-
<
|
|
157
|
+
<AutoPatternsOverridesProvider value={{ actions }}>
|
|
156
158
|
<AutoPatternsApp configuration={config} />
|
|
157
|
-
</
|
|
159
|
+
</AutoPatternsOverridesProvider>
|
|
158
160
|
);
|
|
159
161
|
}
|
|
160
162
|
```
|
|
@@ -171,7 +173,7 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
171
173
|
|
|
172
174
|
1. `id` must:
|
|
173
175
|
- Match exactly the function name of the custom bulk action implementation
|
|
174
|
-
- Be registered in the `actions` property of your `
|
|
176
|
+
- Be registered in the `actions` property of your `AutoPatternsOverridesProvider`
|
|
175
177
|
- Follow JavaScript identifier naming rules (camelCase recommended)
|
|
176
178
|
|
|
177
179
|
2. The implementation must return a `ResolvedAction`:
|
|
@@ -261,7 +263,7 @@ Follow this decision process when implementing Bulk Action Toolbar:
|
|
|
261
263
|
- Less common bulk operations → Place in `secondaryActions` array
|
|
262
264
|
|
|
263
265
|
3. **Custom Implementation**:
|
|
264
|
-
- For `custom` bulk actions, you must provide implementations in your code and register them with `
|
|
266
|
+
- For `custom` bulk actions, you must provide implementations in your code and register them with `AutoPatternsOverridesProvider`
|
|
265
267
|
|
|
266
268
|
### Bulk Action Toolbar Validation Checklist
|
|
267
269
|
|
|
@@ -276,3 +278,6 @@ AI agents should verify these requirements before generating Bulk Action Toolbar
|
|
|
276
278
|
✓ Primary actions use `action`/`menu` structure with proper `action` or `menu` properties
|
|
277
279
|
✓ Secondary actions are an array that can include dividers
|
|
278
280
|
✓ Menu items within primary actions is array that can include dividers
|
|
281
|
+
✓ **MANDATORY**: Every action configuration MUST include a `biName` property for analytics tracking
|
|
282
|
+
✓ **MANDATORY**: `biName` must use descriptive, kebab-case naming (e.g., "bulk-export-pets-action")
|
|
283
|
+
✓ **MANDATORY**: `biName` must be unique across the application and follow the pattern `bulk-{action}-action`
|
|
@@ -26,7 +26,7 @@ The `layout` array contains the rendering components for the collection. Each la
|
|
|
26
26
|
1. **Table Layout Item** (`type: 'Table'`):
|
|
27
27
|
* `table` field contains table-specific configuration
|
|
28
28
|
* Used for displaying collection in a **table view**
|
|
29
|
-
* Includes columns,
|
|
29
|
+
* Includes columns, bulkActionToolbar, etc.
|
|
30
30
|
|
|
31
31
|
2. **Grid Layout Item** (`type: 'Grid'`):
|
|
32
32
|
* `grid` field contains grid-specific configuration
|
|
@@ -34,7 +34,7 @@ In addition to these common properties, each action item must specify a `type` w
|
|
|
34
34
|
### 2. `type: "custom"`
|
|
35
35
|
* **Purpose**: Executes custom JavaScript logic defined in your application's overrides.
|
|
36
36
|
* **Details**:
|
|
37
|
-
* The `custom` object in the configuration is typically empty. The functionality is determined by a custom action resolver function that you implement and register in the `actions` section of your `
|
|
37
|
+
* The `custom` object in the configuration is typically empty. The functionality is determined by a custom action resolver function that you implement and register in the `actions` section of your `AutoPatternsOverridesProvider`. The `id` of this action item must exactly match the name (key) of the registered custom action resolver. The resolver will receive parameters including `collectionId`.
|
|
38
38
|
|
|
39
39
|
### 3. `type: "divider"`
|
|
40
40
|
* **Purpose**: Creates a visual separator between action groups in menus and lists.
|
|
@@ -123,6 +123,7 @@ Custom collection page actions execute JavaScript code that you define for colle
|
|
|
123
123
|
"id": "exportCollection", // MUST match the function name exactly
|
|
124
124
|
"type": "custom", // REQUIRED: Must be exactly "custom"
|
|
125
125
|
"label": "Export Collection", // Optional: Displayed text
|
|
126
|
+
"biName": "export-collection-action", // MANDATORY: Analytics tracking identifier
|
|
126
127
|
"collection": {
|
|
127
128
|
"collectionId": "WixPets",
|
|
128
129
|
"entityTypeSource": "cms"
|
|
@@ -130,7 +131,7 @@ Custom collection page actions execute JavaScript code that you define for colle
|
|
|
130
131
|
}
|
|
131
132
|
```
|
|
132
133
|
|
|
133
|
-
5. Register your action in the `
|
|
134
|
+
5. Register your action in the `AutoPatternsOverridesProvider`:
|
|
134
135
|
```typescript
|
|
135
136
|
import { useActions } from '../components/actions';
|
|
136
137
|
|
|
@@ -138,9 +139,9 @@ Custom collection page actions execute JavaScript code that you define for colle
|
|
|
138
139
|
const actions = useActions();
|
|
139
140
|
|
|
140
141
|
return (
|
|
141
|
-
<
|
|
142
|
+
<AutoPatternsOverridesProvider value={{ actions }}>
|
|
142
143
|
<AutoPatternsApp configuration={config} />
|
|
143
|
-
</
|
|
144
|
+
</AutoPatternsOverridesProvider>
|
|
144
145
|
);
|
|
145
146
|
}
|
|
146
147
|
```
|
|
@@ -212,6 +213,7 @@ export const handleRowClick: CustomActionCollectionPageActionOnRowClickResolver
|
|
|
212
213
|
|
|
213
214
|
// Your custom logic...
|
|
214
215
|
},
|
|
216
|
+
biName: 'view-details-action' // MANDATORY: For analytics tracking
|
|
215
217
|
};
|
|
216
218
|
};
|
|
217
219
|
```
|
|
@@ -247,6 +249,7 @@ export const openSidePanel: CustomActionCollectionPageActionOnRowClickResolver =
|
|
|
247
249
|
// Or use a modal service/context that you've set up
|
|
248
250
|
// modalService.openSidePanel(item);
|
|
249
251
|
},
|
|
252
|
+
biName: 'open-side-panel-action' // MANDATORY: For analytics tracking
|
|
250
253
|
};
|
|
251
254
|
};
|
|
252
255
|
```
|
|
@@ -276,7 +279,7 @@ export const useActions = () => {
|
|
|
276
279
|
}
|
|
277
280
|
```
|
|
278
281
|
|
|
279
|
-
**Step 4: Register in `
|
|
282
|
+
**Step 4: Register in `AutoPatternsOverridesProvider`**:
|
|
280
283
|
```typescript
|
|
281
284
|
import { useActions } from '../components/actions';
|
|
282
285
|
|
|
@@ -284,9 +287,9 @@ export default function YourPage() {
|
|
|
284
287
|
const actions = useActions();
|
|
285
288
|
|
|
286
289
|
return (
|
|
287
|
-
<
|
|
290
|
+
<AutoPatternsOverridesProvider value={{ actions }}>
|
|
288
291
|
<AutoPatternsApp configuration={config} />
|
|
289
|
-
</
|
|
292
|
+
</AutoPatternsOverridesProvider>
|
|
290
293
|
);
|
|
291
294
|
}
|
|
292
295
|
```
|
|
@@ -323,6 +326,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
|
|
|
323
326
|
})
|
|
324
327
|
});
|
|
325
328
|
},
|
|
329
|
+
biName: 'quick-toggle-action' // MANDATORY: For analytics tracking
|
|
326
330
|
};
|
|
327
331
|
};
|
|
328
332
|
```
|
|
@@ -346,7 +350,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
|
|
|
346
350
|
- The implementation must use the `CustomActionCollectionPageActionOnRowClickResolver` type
|
|
347
351
|
- **Required Return Object**: Must return a `ResolvedAction` object - see [ResolvedAction Reference](./resolved_action.md)
|
|
348
352
|
- Access the clicked item's data through `actionParams.item`
|
|
349
|
-
- The implementation must be exported as a named export and registered in your `
|
|
353
|
+
- The implementation must be exported as a named export and registered in your `AutoPatternsOverridesProvider`
|
|
350
354
|
- When `onRowClick` is configured, the default navigation to entity page is completely disabled
|
|
351
355
|
- **Complete Setup Required**: You need to create the action file, export it in the index, and register it in the provider - missing any step will cause errors
|
|
352
356
|
|
|
@@ -364,7 +368,10 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
|
|
|
364
368
|
✓ Divider actions use `{ "type": "divider" }` format and require no additional properties.
|
|
365
369
|
✓ If `onRowClick` is configured in table layout, it must have a valid `id` and `type: "custom"`.
|
|
366
370
|
✓ **CRITICAL**: Custom row click actions must have corresponding implementations registered in the `actions` override - configuration without implementation will cause errors.
|
|
367
|
-
✓ Custom row click action implementations must return
|
|
371
|
+
✓ Custom row click action implementations must return a `ResolvedAction` object with `label`, `icon`, `onClick`, and `biName` properties - all are required. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
368
372
|
✓ Custom row click action implementations must be exported as named exports and included in the actions index file.
|
|
369
373
|
✓ `onRowClick` is optional - when not configured, rows navigate to entity page by default.
|
|
370
374
|
✓ **IMPORTANT**: Configuring `onRowClick` completely disables default navigation - you must handle all row click logic in your custom implementation.
|
|
375
|
+
✓ **MANDATORY**: Every action configuration MUST include a `biName` property for analytics tracking.
|
|
376
|
+
✓ **MANDATORY**: `biName` must use descriptive, kebab-case naming (e.g., "export-collection-action").
|
|
377
|
+
✓ **MANDATORY**: `biName` must be unique across the application and follow the pattern `{action-purpose}-action`.
|
|
@@ -3,9 +3,10 @@
|
|
|
3
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
|
-
- **Always verify override implementation** - when implementing custom overrides, you MUST ensure they are correctly imported and passed to the `
|
|
6
|
+
- **Always verify override implementation** - when implementing custom overrides, you MUST ensure they are correctly imported and passed to the `AutoPatternsOverridesProvider`
|
|
7
|
+
- **CRITICAL: Error handling for custom actions** - Custom actions that make external API calls (using `fetch()`, `axios`, etc.) should NOT use `errorHandler.withErrorHandler`. Only Wix HTTP requests (httpClient from @wix/essentials, Wix APIs like wix/data and wix/stores, and httpClient.fetchWithAuth()) require errorHandler wrapping. See the "Error Handling for HTTP Requests" section for details.
|
|
7
8
|
|
|
8
|
-
The `
|
|
9
|
+
The `AutoPatternsOverridesProvider` allows you to inject custom code to override default behaviors or add additional functionality. Below are the areas where overrides can be applied:
|
|
9
10
|
|
|
10
11
|
> **Note:** These are the only areas where overrides are supported. Avoid attempting to override or modify other parts of the system, as this is not supported and may lead to unexpected behavior.
|
|
11
12
|
|
|
@@ -80,9 +81,9 @@ export default function YourPage() {
|
|
|
80
81
|
const entityPageHeaderBadges = useEntityPageHeaderBadges();
|
|
81
82
|
|
|
82
83
|
return (
|
|
83
|
-
<
|
|
84
|
+
<AutoPatternsOverridesProvider value={{ actions, columns, slots, sections, components, modals, customDataSources, entityPageHeaderSubtitle, entityPageHeaderBadges }}>
|
|
84
85
|
<AutoPatternsApp configuration={config} />
|
|
85
|
-
</
|
|
86
|
+
</AutoPatternsOverridesProvider>
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
89
|
```
|
|
@@ -102,7 +103,7 @@ For example:
|
|
|
102
103
|
- Adding a new subtitle override → Update `../components/entityPageHeaderSubtitle/index.tsx` to include the new subtitle in the `useEntityPageHeaderSubtitle` hook
|
|
103
104
|
- Adding a new badges override → Update `../components/entityPageHeaderBadges/index.tsx` to include the new badges in the `useEntityPageHeaderBadges` hook
|
|
104
105
|
|
|
105
|
-
Without updating the hook index files, your implementations won't be available to the `
|
|
106
|
+
Without updating the hook index files, your implementations won't be available to the `AutoPatternsOverridesProvider`.
|
|
106
107
|
|
|
107
108
|
## Common Override Mistakes to Avoid
|
|
108
109
|
|
|
@@ -347,9 +348,9 @@ export default function YourPage() {
|
|
|
347
348
|
const columns = useColumns();
|
|
348
349
|
|
|
349
350
|
return (
|
|
350
|
-
<
|
|
351
|
+
<AutoPatternsOverridesProvider value={{ columns }}>
|
|
351
352
|
<AutoPatternsApp configuration={config} />
|
|
352
|
-
</
|
|
353
|
+
</AutoPatternsOverridesProvider>
|
|
353
354
|
);
|
|
354
355
|
}
|
|
355
356
|
```
|
|
@@ -367,7 +368,7 @@ your-page/
|
|
|
367
368
|
├── fullName.tsx // Calculated column
|
|
368
369
|
└── date.tsx // Enhanced formatting with row context
|
|
369
370
|
|
|
370
|
-
|
|
371
|
+
AutoPatternsOverridesProvider
|
|
371
372
|
└── value.columns (from useColumns hook)
|
|
372
373
|
├── name
|
|
373
374
|
├── petInfo
|
|
@@ -524,9 +525,9 @@ export default function YourPage() {
|
|
|
524
525
|
const components = useComponents();
|
|
525
526
|
|
|
526
527
|
return (
|
|
527
|
-
<
|
|
528
|
+
<AutoPatternsOverridesProvider value={{ components }}>
|
|
528
529
|
<AutoPatternsApp configuration={config} />
|
|
529
|
-
</
|
|
530
|
+
</AutoPatternsOverridesProvider>
|
|
530
531
|
);
|
|
531
532
|
}
|
|
532
533
|
```
|
|
@@ -655,7 +656,7 @@ your-page/
|
|
|
655
656
|
│ ├── combinedNameFields.tsx // Multiple fields override
|
|
656
657
|
│ └── infoCard.tsx // Standalone component
|
|
657
658
|
|
|
658
|
-
|
|
659
|
+
AutoPatternsOverridesProvider
|
|
659
660
|
└── value.components (from useComponents hook)
|
|
660
661
|
├── customNameField
|
|
661
662
|
├── combinedNameFields
|
|
@@ -725,7 +726,7 @@ To enable sections, add the `sections` configuration to your table configuration
|
|
|
725
726
|
|
|
726
727
|
### Custom Data Source Hook Structure
|
|
727
728
|
|
|
728
|
-
Custom data sources are implemented through the `useCustomDataSources` hook in your `
|
|
729
|
+
Custom data sources are implemented through the `useCustomDataSources` hook in your `AutoPatternsOverridesProvider`:
|
|
729
730
|
|
|
730
731
|
```tsx
|
|
731
732
|
import { useCustomDataSources } from '../components/customDataSources';
|
|
@@ -734,9 +735,9 @@ export default function YourPage() {
|
|
|
734
735
|
const customDataSources = useCustomDataSources();
|
|
735
736
|
|
|
736
737
|
return (
|
|
737
|
-
<
|
|
738
|
+
<AutoPatternsOverridesProvider value={{ customDataSources }}>
|
|
738
739
|
<AutoPatternsApp configuration={config} />
|
|
739
|
-
</
|
|
740
|
+
</AutoPatternsOverridesProvider>
|
|
740
741
|
);
|
|
741
742
|
}
|
|
742
743
|
```
|
|
@@ -810,22 +811,7 @@ When implementing custom data sources, you need to map your data source field ty
|
|
|
810
811
|
- **Reference fields** → `'REFERENCE'`
|
|
811
812
|
- **URL fields** → `'URL'`
|
|
812
813
|
|
|
813
|
-
### Error Handling
|
|
814
814
|
|
|
815
|
-
Custom data sources should include proper error handling:
|
|
816
|
-
|
|
817
|
-
```tsx
|
|
818
|
-
actions: {
|
|
819
|
-
get: async (entityId: string) => {
|
|
820
|
-
try {
|
|
821
|
-
const result = await yourDataSourceCall(entityId);
|
|
822
|
-
return result;
|
|
823
|
-
} catch (error) {
|
|
824
|
-
throw new Error(`Failed to fetch entity: ${error.message}`);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
```
|
|
829
815
|
|
|
830
816
|
### Validation Requirements
|
|
831
817
|
|
|
@@ -867,9 +853,9 @@ export default function YourPage() {
|
|
|
867
853
|
const customDataSources = useCustomDataSources();
|
|
868
854
|
|
|
869
855
|
return (
|
|
870
|
-
<
|
|
856
|
+
<AutoPatternsOverridesProvider value={{ customDataSources }}>
|
|
871
857
|
<AutoPatternsApp configuration={config} />
|
|
872
|
-
</
|
|
858
|
+
</AutoPatternsOverridesProvider>
|
|
873
859
|
);
|
|
874
860
|
}
|
|
875
861
|
```
|
|
@@ -878,7 +864,7 @@ export default function YourPage() {
|
|
|
878
864
|
|
|
879
865
|
### Creating Section Renderers
|
|
880
866
|
|
|
881
|
-
Section renderers are functions that determine how to group items and what information to display in section headers. They must be provided through the `
|
|
867
|
+
Section renderers are functions that determine how to group items and what information to display in section headers. They must be provided through the `AutoPatternsOverridesProvider`.
|
|
882
868
|
|
|
883
869
|
#### Function Signature
|
|
884
870
|
|
|
@@ -1004,9 +990,9 @@ import * as sections from './components/sections';
|
|
|
1004
990
|
import * as columns from './components/columns';
|
|
1005
991
|
import * as actions from './components/actions';
|
|
1006
992
|
|
|
1007
|
-
<
|
|
993
|
+
<AutoPatternsOverridesProvider value={{ sections, columns, actions }}>
|
|
1008
994
|
<AutoPatternsApp configuration={config} />
|
|
1009
|
-
</
|
|
995
|
+
</AutoPatternsOverridesProvider>
|
|
1010
996
|
```
|
|
1011
997
|
|
|
1012
998
|
### Important Notes
|
|
@@ -1152,9 +1138,9 @@ export default function YourPage() {
|
|
|
1152
1138
|
const slots = useSlots();
|
|
1153
1139
|
|
|
1154
1140
|
return (
|
|
1155
|
-
<
|
|
1141
|
+
<AutoPatternsOverridesProvider value={{ slots }}>
|
|
1156
1142
|
<AutoPatternsApp configuration={config} />
|
|
1157
|
-
</
|
|
1143
|
+
</AutoPatternsOverridesProvider>
|
|
1158
1144
|
);
|
|
1159
1145
|
}
|
|
1160
1146
|
```
|
package/dist/docs/entity_page.md
CHANGED
|
@@ -22,7 +22,7 @@ When a user asks to "add badges to the entity page", understand that they want:
|
|
|
22
22
|
1. **Custom component overrides** - NOT direct configuration in JSON
|
|
23
23
|
2. **Function that returns badge objects** - NOT JSX components
|
|
24
24
|
3. **Badge properties** like `text`, `skin`, `prefixIcon`, etc.
|
|
25
|
-
4. **Registration in
|
|
25
|
+
4. **Registration in AutoPatternsOverridesProvider** under `entityPageHeaderBadges`
|
|
26
26
|
|
|
27
27
|
**Example Request**: "Add 2 badges with random skins and text 'wow'"
|
|
28
28
|
**Correct Implementation**: Create a function that returns `[{text: 'wow', skin: 'success'}, {text: 'wow', skin: 'premium'}]`
|
|
@@ -116,7 +116,7 @@ const Index: FC = () => {
|
|
|
116
116
|
const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
|
|
117
117
|
|
|
118
118
|
return (
|
|
119
|
-
<
|
|
119
|
+
<AutoPatternsOverridesProvider
|
|
120
120
|
value={{
|
|
121
121
|
// ... other overrides
|
|
122
122
|
entityPageHeaderSubtitle: {
|
|
@@ -125,7 +125,7 @@ const Index: FC = () => {
|
|
|
125
125
|
}}
|
|
126
126
|
>
|
|
127
127
|
<WixPetsPage />
|
|
128
|
-
</
|
|
128
|
+
</AutoPatternsOverridesProvider>
|
|
129
129
|
);
|
|
130
130
|
};
|
|
131
131
|
```
|
|
@@ -176,16 +176,16 @@ export const myFunction = (entity) => { ... }
|
|
|
176
176
|
|
|
177
177
|
### Integration
|
|
178
178
|
|
|
179
|
-
Register your subtitle override in the `
|
|
179
|
+
Register your subtitle override in the `AutoPatternsOverridesProvider`:
|
|
180
180
|
|
|
181
181
|
```typescript
|
|
182
|
-
<
|
|
182
|
+
<AutoPatternsOverridesProvider value={{
|
|
183
183
|
entityPageHeaderSubtitle: {
|
|
184
184
|
mySubtitleOverride,
|
|
185
185
|
},
|
|
186
186
|
}}>
|
|
187
187
|
<AutoPatternsApp configuration={config} />
|
|
188
|
-
</
|
|
188
|
+
</AutoPatternsOverridesProvider>
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
## Entity Page Dynamic Badges
|
|
@@ -218,7 +218,7 @@ When implementing badges for entity pages, understand these key points:
|
|
|
218
218
|
1. **Badges are CUSTOM COMPONENT OVERRIDES** - NOT direct configuration
|
|
219
219
|
2. **Badge function returns an ARRAY of badge objects** - NOT JSX components
|
|
220
220
|
3. **Each badge object has properties** like `text`, `skin`, `prefixIcon`, etc.
|
|
221
|
-
4. **Must be registered in
|
|
221
|
+
4. **Must be registered in AutoPatternsOverridesProvider** under `entityPageHeaderBadges`
|
|
222
222
|
|
|
223
223
|
### Complete Implementation Guide
|
|
224
224
|
|
|
@@ -273,7 +273,7 @@ const Index: FC = () => {
|
|
|
273
273
|
const entityPageHeaderBadges = useEntityPageHeaderBadges();
|
|
274
274
|
|
|
275
275
|
return (
|
|
276
|
-
<
|
|
276
|
+
<AutoPatternsOverridesProvider
|
|
277
277
|
value={{
|
|
278
278
|
// ... other overrides
|
|
279
279
|
entityPageHeaderSubtitle: {
|
|
@@ -285,7 +285,7 @@ const Index: FC = () => {
|
|
|
285
285
|
}}
|
|
286
286
|
>
|
|
287
287
|
<WixPetsPage />
|
|
288
|
-
</
|
|
288
|
+
</AutoPatternsOverridesProvider>
|
|
289
289
|
);
|
|
290
290
|
};
|
|
291
291
|
```
|
|
@@ -327,7 +327,7 @@ src/dashboard/
|
|
|
327
327
|
|
|
328
328
|
1. **❌ DON'T return JSX components** - Return badge objects instead
|
|
329
329
|
2. **❌ DON'T use direct configuration** - Use custom component overrides
|
|
330
|
-
3. **❌ DON'T forget to register in
|
|
330
|
+
3. **❌ DON'T forget to register in AutoPatternsOverridesProvider**
|
|
331
331
|
5. **❌ DON'T forget to export from index.ts** - Must export the function
|
|
332
332
|
|
|
333
333
|
|
|
@@ -21,18 +21,21 @@ Entity pages in **edit mode** support not only built-in actions (such as "Save"
|
|
|
21
21
|
{
|
|
22
22
|
"id": "sendEmail",
|
|
23
23
|
"type": "custom",
|
|
24
|
-
"label": "Send Email"
|
|
24
|
+
"label": "Send Email",
|
|
25
|
+
"biName": "send-email-action"
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
"id": "exportData",
|
|
28
29
|
"type": "custom",
|
|
29
|
-
"label": "Export Data"
|
|
30
|
+
"label": "Export Data",
|
|
31
|
+
"biName": "export-data-action"
|
|
30
32
|
},
|
|
31
33
|
{ "type": "divider" },
|
|
32
34
|
{
|
|
33
35
|
"id": "archiveEntity",
|
|
34
36
|
"type": "custom",
|
|
35
|
-
"label": "Archive"
|
|
37
|
+
"label": "Archive",
|
|
38
|
+
"biName": "archive-entity-action"
|
|
36
39
|
}
|
|
37
40
|
]
|
|
38
41
|
}
|
|
@@ -59,6 +62,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
59
62
|
onClick: () => {
|
|
60
63
|
// Your custom logic here
|
|
61
64
|
},
|
|
65
|
+
biName: 'my-more-action' // MANDATORY: For analytics tracking
|
|
62
66
|
};
|
|
63
67
|
};
|
|
64
68
|
```
|
|
@@ -84,9 +88,12 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
84
88
|
✓ Each action in `moreActions` has a unique `id` and correct `type` value
|
|
85
89
|
✓ Each action type only includes its required field(s)
|
|
86
90
|
✓ Custom actions match implementations in overrides
|
|
87
|
-
✓ The resolver is exported and registered in the `actions` property of your `
|
|
91
|
+
✓ The resolver is exported and registered in the `actions` property of your `AutoPatternsOverridesProvider`
|
|
88
92
|
✓ The function signature matches `CustomEntityPageActionResolver`
|
|
89
93
|
✓ The returned object is a `ResolvedAction` (see [ResolvedAction Reference](./resolved_action.md))
|
|
94
|
+
✓ **MANDATORY**: Every action configuration MUST include a `biName` property for analytics tracking
|
|
95
|
+
✓ **MANDATORY**: `biName` must use descriptive, kebab-case naming (e.g., "send-email-action")
|
|
96
|
+
✓ **MANDATORY**: `biName` must be unique across the application and follow the pattern `{action-purpose}-action`
|
|
90
97
|
|
|
91
98
|
---
|
|
92
99
|
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Error Handling for HTTP Requests
|
|
2
|
+
|
|
3
|
+
**⚠️ CRITICAL**: When implementing custom data sources that make HTTP requests, you **MUST** wrap specific HTTP calls with proper error handling. This ensures consistent error management, prevents unhandled promise rejections, and provides better user experience.
|
|
4
|
+
|
|
5
|
+
## What Requires Error Handling
|
|
6
|
+
|
|
7
|
+
**ONLY the following HTTP requests** in your custom data source actions must be wrapped with `errorHandler`:
|
|
8
|
+
|
|
9
|
+
- **httpClient from @wix/essentials** (e.g., `httpClient.request(getDummyEntity(...))`)
|
|
10
|
+
- **Wix APIs** (e.g., `wix/data`, `wix/stores`, `items.get()`, `items.insert()`, `collections.getDataCollection()`)
|
|
11
|
+
- **httpClient.fetchWithAuth()** calls
|
|
12
|
+
|
|
13
|
+
**DO NOT use errorHandler with:**
|
|
14
|
+
|
|
15
|
+
- **External API calls** using `fetch()`, `axios.get()`, or other HTTP libraries
|
|
16
|
+
- **Custom HTTP clients** (e.g., any non-Wix HTTP request library)
|
|
17
|
+
- **Third-party API calls** using non-Wix HTTP methods
|
|
18
|
+
|
|
19
|
+
**EXCEPTION**: SDK actions that you get from the AutoPatterns SDK (e.g., `sdk.getOptimisticActions()`, `sdk.getSchema()`) do NOT need error handling as they are already handled internally.
|
|
20
|
+
|
|
21
|
+
## Why Error Handling is Required
|
|
22
|
+
|
|
23
|
+
Custom data sources often make HTTP requests to Wix APIs and services. Without proper error handling:
|
|
24
|
+
|
|
25
|
+
- **Unhandled Promise Rejections**: HTTP failures can crash your application
|
|
26
|
+
- **Poor User Experience**: Users don't get meaningful error messages
|
|
27
|
+
- **Inconsistent Error Management**: Different parts of your app handle errors differently
|
|
28
|
+
- **Debugging Difficulties**: Hard to trace and diagnose API failures
|
|
29
|
+
|
|
30
|
+
## Using @wix/essentials errorHandler
|
|
31
|
+
|
|
32
|
+
The recommended approach is to use the `errorHandler` from `@wix/essentials` package, which provides consistent error handling patterns across Wix applications.
|
|
33
|
+
|
|
34
|
+
### Installation
|
|
35
|
+
|
|
36
|
+
First, ensure `@wix/essentials` is installed in your project:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @wix/essentials
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Basic Error Handling Pattern
|
|
43
|
+
|
|
44
|
+
Wrap Wix HTTP requests in your custom data source actions with `errorHandler.withErrorHandler`:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { errorHandler } from '@wix/essentials';
|
|
48
|
+
|
|
49
|
+
// In your custom data source actions
|
|
50
|
+
actions: {
|
|
51
|
+
get: async (entityId: string) => {
|
|
52
|
+
return errorHandler.withErrorHandler(
|
|
53
|
+
async () => {
|
|
54
|
+
const response = await httpClient.request(
|
|
55
|
+
getDummyEntity({ dummyEntityId: entityId })
|
|
56
|
+
);
|
|
57
|
+
return response.data.dummyEntity;
|
|
58
|
+
},
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Examples of HTTP Requests That Need Error Handling
|
|
66
|
+
|
|
67
|
+
**httpClient from @wix/essentials:**
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
return errorHandler.withErrorHandler(async () => {
|
|
71
|
+
const response = await httpClient.request(
|
|
72
|
+
getDummyEntity({ dummyEntityId: entityId })
|
|
73
|
+
);
|
|
74
|
+
return response.data.dummyEntity;
|
|
75
|
+
}, {});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Wix APIs (wix/data, wix/stores):**
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
return errorHandler.withErrorHandler(async () => {
|
|
82
|
+
return await items.get(collectionId, entityId);
|
|
83
|
+
}, {});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**httpClient.fetchWithAuth() calls:**
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
return errorHandler.withErrorHandler(async () => {
|
|
90
|
+
const response = await httpClient.fetchWithAuth("/api/data");
|
|
91
|
+
return await response.json();
|
|
92
|
+
}, {});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Examples of HTTP Requests That Do NOT Need Error Handling
|
|
96
|
+
|
|
97
|
+
**External API calls (using fetch, axios, etc.):**
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// ✅ CORRECT - No error handling needed for external APIs
|
|
101
|
+
const response = await fetch("https://api.example.com/data");
|
|
102
|
+
return await response.json();
|
|
103
|
+
|
|
104
|
+
// ✅ CORRECT - No error handling needed for axios
|
|
105
|
+
const response = await axios.get("https://api.example.com/data");
|
|
106
|
+
return response.data;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Third-party HTTP libraries:**
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// ✅ CORRECT - No error handling needed for third-party HTTP clients
|
|
113
|
+
const response = await someThirdPartyHttpClient.get("/data");
|
|
114
|
+
return response.data;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Integration with AutoPatterns Error Handling
|
|
118
|
+
|
|
119
|
+
The error handling in your custom data source integrates seamlessly with AutoPatterns' built-in error handling:
|
|
120
|
+
|
|
121
|
+
1. **User-Friendly Messages**: Errors are displayed to users in a consistent format
|
|
122
|
+
2. **Retry Mechanisms**: Users can retry failed operations
|
|
123
|
+
3. **Loading States**: Proper loading states during HTTP requests
|
|
124
|
+
4. **Error Boundaries**: Errors are caught and handled gracefully
|
|
125
|
+
|
|
126
|
+
## Validation Checklist
|
|
127
|
+
|
|
128
|
+
Before deploying your custom data source, ensure:
|
|
129
|
+
|
|
130
|
+
✅ **httpClient from @wix/essentials** is wrapped with `errorHandler.withErrorHandler`
|
|
131
|
+
✅ **Wix APIs (wix/data, wix/stores, etc)** are wrapped with `errorHandler.withErrorHandler`
|
|
132
|
+
✅ **httpClient.fetchWithAuth()** calls are wrapped with `errorHandler.withErrorHandler`
|
|
133
|
+
✅ **External API calls are NOT wrapped** with errorHandler (e.g., fetch(), axios, third-party HTTP clients)
|
|
134
|
+
✅ **SDK actions are used directly** without error handling (e.g., `sdk.getOptimisticActions()`, `sdk.getSchema()`)
|
|
135
|
+
✅ **@wix/essentials** is installed as a dependency
|
package/dist/docs/index.md
CHANGED
|
@@ -66,6 +66,10 @@ This index maps user requests to the appropriate section IDs for fetching releva
|
|
|
66
66
|
**Topics**: Package installation, setup process, component integration, provider setup
|
|
67
67
|
**Keywords**: installation, setup, getting started, initial setup, package installation, dependencies, component integration, provider setup
|
|
68
68
|
|
|
69
|
+
### ID: `app_context`
|
|
70
|
+
**Topics**: AppContext feature, accessing collection data, useAppContext hook, children components, modals, side panels
|
|
71
|
+
**Keywords**: AppContext, useAppContext, collection data access, children, modals, side panels, overlay components, outside main interface
|
|
72
|
+
|
|
69
73
|
### ID: `custom_overrides`
|
|
70
74
|
**Topics**: Customization, overrides, custom components, column customization, folder structure
|
|
71
75
|
**Keywords**: customization, custom functionality, overrides, extending functionality, custom components, custom rendering, column overrides, folder structure, organization, row data access
|
|
@@ -74,6 +78,10 @@ This index maps user requests to the appropriate section IDs for fetching releva
|
|
|
74
78
|
**Topics**: FQDN-based custom data sources, Wix Business API integration, schema mapping, custom data source implementation
|
|
75
79
|
**Keywords**: FQDN, Wix Business API, custom data source, schema mapping, client library, field type mapping, custom implementation, entityTypeSource custom, Business API integration, schema extraction
|
|
76
80
|
|
|
81
|
+
### ID: `error_handling`
|
|
82
|
+
**Topics**: HTTP request error handling, errorHandler usage, custom data source error management, API error handling
|
|
83
|
+
**Keywords**: error handling, HTTP errors, API errors, errorHandler, @wix/essentials, custom data source errors, error management, promise rejections, user experience, error messages
|
|
84
|
+
|
|
77
85
|
---
|
|
78
86
|
|
|
79
87
|
## Recipe Section IDs (Step-by-Step Guides)
|
|
@@ -56,7 +56,7 @@ import React, { type FC } from 'react';
|
|
|
56
56
|
import { WixDesignSystemProvider } from '@wix/design-system';
|
|
57
57
|
import '@wix/design-system/styles.global.css';
|
|
58
58
|
import { WixPatternsProvider } from '@wix/patterns/provider';
|
|
59
|
-
import {
|
|
59
|
+
import { AutoPatternsOverridesProvider, AutoPatternsApp } from '@wix/auto-patterns';
|
|
60
60
|
import { withDashboard } from '@wix/patterns';
|
|
61
61
|
|
|
62
62
|
import { config } from './MyCollectionConfig.patterns';
|
|
@@ -65,9 +65,9 @@ const Index: FC = () => {
|
|
|
65
65
|
return (
|
|
66
66
|
<WixDesignSystemProvider features={{ newColorsBranding: true }}>
|
|
67
67
|
<WixPatternsProvider>
|
|
68
|
-
<
|
|
68
|
+
<AutoPatternsOverridesProvider value={{ }}>
|
|
69
69
|
<AutoPatternsApp configuration={config} />
|
|
70
|
-
</
|
|
70
|
+
</AutoPatternsOverridesProvider>
|
|
71
71
|
</WixPatternsProvider>
|
|
72
72
|
</WixDesignSystemProvider>
|
|
73
73
|
);
|