@wix/agent-skills 1.16.0 → 1.16.2

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 (94) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +72 -8
  3. package/skills/wix-app/references/CODE_QUALITY.md +0 -1
  4. package/skills/wix-app/references/DASHBOARD_MODAL.md +21 -14
  5. package/skills/wix-app/references/DASHBOARD_PAGE.md +30 -184
  6. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +19 -3
  7. package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +172 -0
  8. package/skills/wix-app/references/dashboard-page/WDS_LAYOUT.md +187 -0
  9. package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +12 -7
  10. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +31 -2
  11. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +6 -1
  12. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +60 -0
  13. package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +6 -6
  14. package/skills/wix-app/references/editor-react-component/FUNCTION-HANDLERS.md +167 -0
  15. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +2 -2
  16. package/skills/wix-app/references/editor-react-component/SITE-CONTEXT-HOOKS.md +187 -0
  17. package/skills/wix-app/scripts/scan-a11y-code.cjs +777 -0
  18. package/skills/wix-app/scripts/scan-a11y-eslint.cjs +201 -0
  19. package/skills/wix-base44-connector/SKILL.md +185 -0
  20. package/skills/wix-base44-connector/scripts/utils.js +212 -0
  21. package/skills/wix-design-system/SKILL.md +19 -15
  22. package/skills/wix-docs/SKILL.md +75 -1
  23. package/skills/wix-headless/references/CAPABILITIES.md +16 -3
  24. package/skills/wix-headless/references/SDK_HANDOFF.md +1 -1
  25. package/skills/wix-headless/references/SEED.md +1 -1
  26. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +560 -102
  27. package/skills/wix-headless/references/inline-recipes/setup-forms.md +210 -143
  28. package/skills/wix-manage/SKILL.md +20 -17
  29. package/skills/wix-manage/references/accessibility/scan-site-accessibility.md +98 -0
  30. package/skills/wix-manage/references/analytics/analytics-dashboard-navigation.md +1 -2
  31. package/skills/wix-manage/references/domains/domain-search-purchase-and-connect.md +2603 -0
  32. package/skills/wix-manage/references/events/create-wix-event.md +112 -90
  33. package/skills/wix-manage/references/events/manage-wix-events.md +33 -94
  34. package/skills/wix-manage/references/sites/create-headless-site.md +1 -0
  35. package/skills/wix-manage/references/sites/manage-oauth-apps.md +154 -0
  36. package/skills/wix-manage/references/sites/read-site-context.md +125 -0
  37. package/skills/wix-manage/references/sites/site-import.md +67 -15
  38. package/skills/wix-manage/references/stores/create-product-catalog-v3.md +273 -0
  39. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +1 -1
  40. package/skills/wix-vibe-headless/SKILL.md +2 -1
  41. package/skills/wix-vibe-headless/install/deploy.cjs +63 -3
  42. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +104 -0
  43. package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +74 -0
  44. package/skills/wix-vibe-headless/platforms/base44.md +15 -40
  45. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +7 -11
  46. package/skills/wix-vibe-headless/references/blog/seed/SEED.md +1 -1
  47. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +7 -11
  48. package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +1 -1
  49. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +1 -2
  50. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +7 -12
  51. package/skills/wix-vibe-headless/references/events/seed/SEED.md +1 -1
  52. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +7 -11
  53. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +7 -11
  54. package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +1 -1
  55. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +7 -11
  56. package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +1 -1
  57. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +7 -11
  58. package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +1 -1
  59. package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +1 -1
  60. package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +5 -3
  61. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +75 -13
  62. package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +29 -86
  63. package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +3 -8
  64. package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +78 -105
  65. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductCard.js +92 -0
  66. package/skills/wix-vibe-headless/references/storefront/app/hooks/useVariantOptions.js +76 -0
  67. package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +1 -1
  68. package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +44 -5
  69. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +0 -326
  70. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +0 -115
  71. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +0 -264
  72. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +0 -37
  73. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +0 -86
  74. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +0 -119
  75. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +0 -103
  76. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +0 -76
  77. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +0 -82
  78. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +0 -89
  79. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +0 -124
  80. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +0 -91
  81. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +0 -71
  82. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +0 -70
  83. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +0 -73
  84. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +0 -98
  85. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +0 -278
  86. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +0 -94
  87. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +0 -43
  88. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +0 -66
  89. package/skills/wix-app/references/auto-patterns-dashboard/views.md +0 -76
  90. package/skills/wix-app/scripts/generate-auto-patterns.js +0 -510
  91. package/skills/wix-manage/references/domains/domain-search-and-purchase.md +0 -437
  92. package/skills/wix-manage/references/stores/create-product-from-image.md +0 -1031
  93. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +0 -623
  94. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +0 -106
@@ -1,264 +0,0 @@
1
- # AppConfig Rules
2
-
3
- ## Type Definitions
4
- ```typescript
5
- export interface AppConfig {
6
- pages: PageConfig[];
7
- }
8
-
9
- type PageConfig = CollectionPageConfig | EntityPageConfig;
10
-
11
- interface PageBase {
12
- id: string; // Unique across app
13
- appMainPage?: boolean; // ONE page must be true
14
- }
15
-
16
- interface CollectionPageConfig extends PageBase {
17
- type: 'collectionPage';
18
- collectionPage: {
19
- route: { path: string };
20
- title: { text: string; hideTotal?: boolean };
21
- subtitle?: { text: string };
22
- actions?: PageActions;
23
- components: [CollectionComponent | CustomComponent]; // EXACTLY ONE component with layout
24
- };
25
- }
26
-
27
- interface EntityPageConfig extends PageBase {
28
- type: 'entityPage';
29
- entityPage: {
30
- mode?: 'edit' | 'view'; // Default 'edit'
31
- route: { path: string; params: { id: string } };
32
- title?: { text: string; badges?: { id?: string } };
33
- subtitle?: { text: string; id?: string };
34
- actions?: EntityPageActions;
35
- parentPageId?: string; // ID of parent collection page
36
- collectionId: string;
37
- entityTypeSource: 'cms' | 'custom';
38
- custom?: { id: string }; // REQUIRED if entityTypeSource='custom'
39
- layout?: {
40
- main: CardLayout[];
41
- sidebar?: CardLayout[];
42
- };
43
- };
44
- }
45
-
46
- // Action Types
47
- interface PageActions {
48
- primaryActions?: ActionGroup;
49
- secondaryActions?: ActionGroup;
50
- }
51
-
52
- interface EntityPageActions {
53
- primaryActions?: ActionGroup; // View mode only
54
- secondaryActions?: ActionGroup; // View mode only
55
- moreActions?: CustomAction[]; // Both modes
56
- }
57
-
58
- type ActionGroup = { type: 'action'; action?: { item: ActionItem } } | { type: 'menu'; menu?: { label: string; items: ActionItem[] } };
59
-
60
- interface ActionItem {
61
- id: string;
62
- type: 'create' | 'update' | 'delete' | 'custom' | 'bulkDelete';
63
- label?: string;
64
- biName: string; // MANDATORY
65
- skin?: string;
66
- disabled?: boolean;
67
- tooltip?: string;
68
- collection?: CollectionSource; // For create action
69
- create?: { mode: 'page'; page: { id: string } };
70
- update?: { mode: 'page'; page: { id: string } };
71
- delete?: { mode: 'modal'; modal: ModalConfig };
72
- bulkDelete?: { mode: 'modal'; modal: ModalConfig };
73
- }
74
-
75
- // Component Types
76
- interface CollectionComponent {
77
- type: 'collection';
78
- entityPageId?: string;
79
- collection: CollectionSettings;
80
- filters?: FilterConfig;
81
- actionCell?: ActionCellConfig;
82
- bulkActionToolbar?: BulkActionToolbar;
83
- toolbarTitle?: ToolbarTitle;
84
- views?: ViewsConfig;
85
- search?: { shown?: boolean };
86
- emptyState?: EmptyStateConfig;
87
- dragAndDrop?: { enabled: boolean; dragAndDropCancel?: { id?: string } };
88
- layout: [TableLayout, GridLayout];
89
- }
90
-
91
- interface CustomComponent {
92
- type: 'custom';
93
- id: string;
94
- }
95
-
96
- // Sub-Types
97
- interface CollectionSource {
98
- collectionId: string;
99
- entityTypeSource: 'cms' | 'custom';
100
- custom?: { id: string };
101
- }
102
-
103
- interface CollectionSettings extends CollectionSource {
104
- reflectQueryInUrl?: boolean;
105
- selectAllScope?: 'page' | 'all';
106
- selectionUpdateMode?: 'preserve' | 'clear';
107
- paginationMode?: 'cursor' | 'offset';
108
- }
109
-
110
- interface TableLayout {
111
- type: 'Table';
112
- table?: {
113
- columns: ColumnConfig[];
114
- customColumns?: { enabled: boolean };
115
- dataExtension?: { enabled: boolean };
116
- stickyColumns?: number;
117
- showTitleBar?: boolean;
118
- };
119
- }
120
-
121
- interface GridLayout {
122
- type: 'Grid';
123
- grid?: {
124
- item: {
125
- titleFieldId: string;
126
- subtitleFieldId?: string;
127
- imageFieldId?: string;
128
- cardContentMode?: 'full' | 'title' | 'empty';
129
- imagePlacement?: 'top' | 'side';
130
- };
131
- };
132
- }
133
- ```
134
-
135
- ## Validation Logic
136
- - **IF** `entityTypeSource` is `'custom'` **THEN** `custom: { id: "..." }` is **REQUIRED**.
137
- - **IF** `type: 'collectionPage'` **THEN** `collectionPage` object is **REQUIRED**, `entityPage` object is **FORBIDDEN**.
138
- - **IF** `type: 'entityPage'` **THEN** `entityPage` object is **REQUIRED**, `collectionPage` object is **FORBIDDEN**.
139
- - **IF** `type: 'action'` **THEN** `action` property is **REQUIRED**.
140
- - **IF** `type: 'menu'` **THEN** `menu` property is **REQUIRED**.
141
- - **IF** action type is `'create'` **THEN** `create` config is **REQUIRED**.
142
- - **IF** action type is `'update'` **THEN** `update` config is **REQUIRED**.
143
- - **IF** action type is `'delete'` **THEN** `delete` config is **REQUIRED**.
144
-
145
- ## Implementation Rules
146
- - **MUST** include `biName` in EVERY action configuration (format: kebab-case, `{action-purpose}-action`).
147
- - **MUST** designate exactly ONE page as `appMainPage: true`.
148
- - **MUST** use TypeScript for configuration.
149
- - **NEVER** fill optional fields unless explicitly requested.
150
- - **NEVER** mix page types in a single configuration.
151
- - **NEVER** set `stickyColumns` to negative, zero, or > column count.
152
- - **NEVER** invent enum values; ASK user for values.
153
-
154
- ## page.tsx Structure
155
- ```tsx
156
- import React from 'react';
157
- import { WixDesignSystemProvider } from '@wix/design-system';
158
- import '@wix/design-system/styles.global.css';
159
- import { WixPatternsProvider } from '@wix/patterns/provider';
160
- import { PatternsWizardOverridesProvider, AutoPatternsApp, type AppConfig } from '@wix/auto-patterns';
161
- import { withDashboard } from '@wix/patterns';
162
- import config from './patterns.json';
163
-
164
- const Index: React.FC = () => {
165
- return (
166
- <WixDesignSystemProvider features={{ newColorsBranding: true }}>
167
- <WixPatternsProvider>
168
- <PatternsWizardOverridesProvider value={{}}>
169
- <AutoPatternsApp configuration={config as AppConfig} />
170
- </PatternsWizardOverridesProvider>
171
- </WixPatternsProvider>
172
- </WixDesignSystemProvider>
173
- );
174
- };
175
-
176
- export default withDashboard(Index);
177
- ```
178
-
179
- ## Canonical Example
180
- ```typescript
181
- export const config: AppConfig = {
182
- pages: [
183
- {
184
- id: "product-list",
185
- type: "collectionPage",
186
- appMainPage: true,
187
- collectionPage: {
188
- route: { path: "/" },
189
- title: { text: "Products" },
190
- actions: {
191
- primaryActions: {
192
- type: "action",
193
- action: {
194
- item: {
195
- id: "create-product",
196
- type: "create",
197
- label: "Add Product",
198
- biName: "create-product-action",
199
- collection: {
200
- collectionId: "products",
201
- entityTypeSource: "cms"
202
- },
203
- create: {
204
- mode: "page",
205
- page: { id: "product-details" }
206
- }
207
- }
208
- }
209
- }
210
- },
211
- components: [
212
- {
213
- type: "collection",
214
- entityPageId: "product-details",
215
- collection: {
216
- collectionId: "products",
217
- entityTypeSource: "cms"
218
- },
219
- layout: [
220
- {
221
- type: "Table",
222
- table: {
223
- columns: [
224
- { id: "name", name: "Name", width: "200px" },
225
- { id: "price", name: "Price", width: "100px" }
226
- ]
227
- }
228
- },
229
- {
230
- type: "Grid",
231
- grid: {
232
- item: { titleFieldId: "name" }
233
- }
234
- }
235
- ]
236
- }
237
- ]
238
- }
239
- },
240
- {
241
- id: "product-details",
242
- type: "entityPage",
243
- entityPage: {
244
- route: { path: "/product/:id", params: { id: "id" } },
245
- collectionId: "products",
246
- entityTypeSource: "cms",
247
- layout: {
248
- main: [
249
- {
250
- type: "card",
251
- card: {
252
- title: { text: "Basic Info" },
253
- children: [
254
- { type: "field", field: { fieldId: "name" } }
255
- ]
256
- }
257
- }
258
- ]
259
- }
260
- }
261
- }
262
- ]
263
- };
264
- ```
@@ -1,37 +0,0 @@
1
- # AppContext Rules
2
-
3
- ## Type Definitions
4
- ```typescript
5
- interface AppContext {
6
- items: any[];
7
- refreshCollection: () => void;
8
- }
9
- ```
10
-
11
- ## Validation Logic
12
- - **IF** using `useAppContext` **THEN** component MUST be inside `AutoPatternsApp` (as children).
13
-
14
- ## Implementation Rules
15
- - **MUST** wrap child components (modals, panels) with `<AutoPatternsApp>`.
16
- - **MUST** use `useAppContext` to access shared collection data/refresh.
17
- - **MUST** use `refreshCollection` after data mutations in external components.
18
- - **NEVER** use `useAppContext` outside of the `AutoPatternsApp` tree.
19
-
20
- ## Canonical Example
21
- ```typescript
22
- // 1. Child Component
23
- const MyModal = () => {
24
- const { items, refreshCollection } = useAppContext();
25
- return (
26
- <Modal>
27
- <Text>Count: {items.length}</Text>
28
- <Button onClick={refreshCollection}>Refresh</Button>
29
- </Modal>
30
- );
31
- };
32
-
33
- // 2. Integration
34
- <AutoPatternsApp configuration={config}>
35
- <MyModal />
36
- </AutoPatternsApp>
37
- ```
@@ -1,86 +0,0 @@
1
- # Bulk Actions Rules
2
-
3
- ## Type Definitions
4
- ```typescript
5
- interface BulkActionToolbar {
6
- primaryActions?: BulkActionGroup[];
7
- secondaryActions?: (BulkActionItem | DividerItem)[];
8
- }
9
-
10
- type BulkActionGroup = | { type: 'action'; action: { item: BulkActionItem } } | { type: 'menu'; menu: { label: string; items: (BulkActionItem | DividerItem)[] } };
11
-
12
- interface DividerItem {
13
- type: 'divider';
14
- }
15
-
16
- interface BulkActionItem {
17
- id: string; // Must match custom resolver name
18
- type: 'bulkDelete' | 'custom';
19
- label?: string;
20
- biName: string; // MANDATORY
21
- bulkDelete?: {
22
- mode: 'modal';
23
- modal: {
24
- title?: { text?: string; id?: string };
25
- description?: { text: string };
26
- actions?: { submit?: { text: string }; cancel?: { text: string } };
27
- feedback?: { successToast?: { text: string }; errorToast?: { text: string } };
28
- };
29
- };
30
- }
31
-
32
- type CustomBulkActionsActionResolver = (params: {
33
- actionParams: { selectedValues: any[]; total: number };
34
- sdk: AutoPatternsSDK;
35
- }) => ResolvedAction;
36
- ```
37
-
38
- ## Validation Logic
39
- - **IF** `type: 'bulkDelete'` **THEN** `bulkDelete.mode: 'modal'` is **REQUIRED**.
40
- - **IF** `type: 'custom'` **THEN** resolver implementation is **REQUIRED**.
41
- - **IF** `primaryActions` AND `secondaryActions` both undefined **THEN** toolbar invalid.
42
-
43
- ## Implementation Rules
44
- - **MUST** include `biName` for all bulk actions (`bulk-{action}-action`).
45
- - **MUST** place toolbar configuration inside `table` or `grid` object.
46
- - **MUST** use `CustomBulkActionsActionResolver` type for custom logic.
47
- - **MUST** register custom resolvers in `AutoPatternsOverridesProvider`.
48
- - **MUST** use `errorHandler` for Wix API calls in resolvers.
49
- - **NEVER** use default navigation in bulk actions; implement explicitly.
50
-
51
- ## Canonical Example
52
- ```typescript
53
- // Config
54
- bulkActionToolbar: {
55
- primaryActions: [{
56
- type: 'action',
57
- action: {
58
- item: {
59
- id: 'bulkDelete',
60
- type: 'bulkDelete',
61
- label: 'Delete',
62
- biName: 'bulk-delete-action',
63
- bulkDelete: { mode: 'modal', modal: {} }
64
- }
65
- }
66
- }],
67
- secondaryActions: [
68
- {
69
- id: 'bulkExport',
70
- type: 'custom',
71
- label: 'Export',
72
- biName: 'bulk-export-action'
73
- }
74
- ]
75
- }
76
-
77
- // Resolver
78
- export const bulkExport: CustomBulkActionsActionResolver = ({ actionParams }) => ({
79
- label: 'Export',
80
- icon: <Download />,
81
- biName: 'bulk-export-action',
82
- onClick: () => {
83
- // Logic using actionParams.selectedValues
84
- }
85
- });
86
- ```
@@ -1,119 +0,0 @@
1
- # Collection Page Action Rules
2
-
3
- ## Type Definitions
4
- ```typescript
5
- interface CollectionPageActions {
6
- primaryActions?: ActionGroup;
7
- secondaryActions?: ActionGroup;
8
- }
9
-
10
- type ActionGroup = | { type: 'action'; action: { item: ActionItem } } | { type: 'menu'; menu: { label: string; items: (ActionItem | DividerItem)[] } };
11
-
12
- interface DividerItem {
13
- type: 'divider';
14
- }
15
-
16
- interface ActionItem {
17
- id: string; // Must match custom resolver name if custom
18
- type: 'create' | 'custom';
19
- label?: string;
20
- biName: string; // MANDATORY
21
- collection?: {
22
- collectionId: string;
23
- entityTypeSource: 'cms' | 'custom';
24
- };
25
- create?: {
26
- mode: 'page';
27
- page: { id: string };
28
- };
29
- }
30
-
31
- // Row Click Action (Table level)
32
- interface OnRowClickConfig {
33
- id: string;
34
- type: 'custom';
35
- }
36
-
37
- // Row Click Resolver Signature - NOTE: item is nested under actionParams
38
- type CustomActionCollectionPageActionOnRowClickResolver = (params: {
39
- actionParams: { item: any }; // The clicked row's data - nested under actionParams
40
- sdk: AutoPatternsSDK;
41
- }) => ResolvedAction;
42
- ```
43
-
44
- ## Validation Logic
45
- - **IF** `type: 'create'` **THEN** `create` config with `page.id` is **REQUIRED**.
46
- - **IF** `type: 'custom'` **THEN** `id` must match a registered resolver name.
47
- - **IF** `onRowClick` is configured **THEN** matching `custom` resolver is **MANDATORY**.
48
- - **IF** `onRowClick` is configured **THEN** default navigation is **DISABLED**.
49
- - **IF** `onRowClick` resolver accesses row data **THEN** use `actionParams.item` (NOT direct `item` param).
50
-
51
- ## Implementation Rules
52
- - **MUST** include a `create` action in `primaryActions` for every collection page.
53
- - **MUST** include `biName` for every action (kebab-case).
54
- - **MUST** implement custom resolvers using `CustomActionCollectionPageActionResolver`.
55
- - **MUST** implement row click resolvers using `CustomActionCollectionPageActionOnRowClickResolver` returning `ResolvedAction`.
56
- - **MUST** place onRowClick resolvers in `components/actions/` folder (same as other custom actions).
57
- - **MUST** register onRowClick resolvers via `useActions` hook pattern (see **custom_actions_override**).
58
- - **NEVER** mix `create` logic with `custom` action types.
59
- - **NEVER** assume `schema` or `optimisticActions` exist without checking.
60
-
61
- ## Canonical Example
62
- ```typescript
63
- {
64
- primaryActions: {
65
- type: 'action',
66
- action: {
67
- item: {
68
- id: 'create-pet',
69
- type: 'create',
70
- label: 'Add Pet',
71
- biName: 'create-pet-action',
72
- collection: { collectionId: 'pets', entityTypeSource: 'cms' },
73
- create: {
74
- mode: 'page',
75
- page: { id: 'pet-details' }
76
- }
77
- }
78
- }
79
- },
80
- secondaryActions: {
81
- type: 'menu',
82
- menu: {
83
- label: 'More',
84
- items: [
85
- {
86
- id: 'exportCollection',
87
- type: 'custom',
88
- label: 'Export',
89
- biName: 'export-action',
90
- collection: { collectionId: 'pets', entityTypeSource: 'cms' }
91
- }
92
- ]
93
- }
94
- }
95
- }
96
- ```
97
-
98
- ## Canonical Example (onRowClick)
99
- ```typescript
100
- // Config
101
- {
102
- "onRowClick": {
103
- "id": "myRowClickAction",
104
- "type": "custom"
105
- }
106
- }
107
-
108
- // Resolver (if custom) - see custom_actions_override for full registration pattern
109
- export const myRowClickAction: CustomActionCollectionPageActionOnRowClickResolver = ({
110
- actionParams: { item }, // item is nested under actionParams
111
- }) => ({
112
- label: 'Custom Action',
113
- icon: <MyIcon />,
114
- biName: 'my-row-click-action',
115
- onClick: () => {
116
- // Custom onClick logic using item
117
- }
118
- });
119
- ```
@@ -1,103 +0,0 @@
1
- # Collection Page Rules
2
-
3
- ## Type Definitions
4
- ```typescript
5
- interface CollectionComponent {
6
- type: 'collection';
7
- entityPageId: string; // REQUIRED for navigation
8
- collection: {
9
- collectionId: string;
10
- entityTypeSource: 'cms' | 'custom';
11
- custom?: { id: string };
12
- };
13
- layout: LayoutItem[];
14
- }
15
-
16
- type LayoutItem = TableLayout | GridLayout;
17
-
18
- interface TableLayout {
19
- type: 'Table';
20
- table: {
21
- columns: ColumnConfig[];
22
- customColumns?: { enabled: boolean };
23
- stickyColumns?: number;
24
- showTitleBar?: boolean;
25
- };
26
- }
27
-
28
- interface ColumnConfig {
29
- id: string; // Field ID
30
- name: string; // Display title
31
- width: string;
32
- tooltipContent?: string; // Info icon text
33
- sortable?: boolean;
34
- hideable?: boolean;
35
- }
36
-
37
- interface GridLayout {
38
- type: 'Grid';
39
- grid: {
40
- item: {
41
- titleFieldId: string; // REQUIRED Field ID
42
- subtitleFieldId?: string; // Field ID
43
- imageFieldId?: string; // Field ID
44
- cardContentMode?: 'full' | 'title' | 'empty';
45
- };
46
- };
47
- }
48
- ```
49
-
50
- ## Validation Logic
51
- - **IF** `components` array length != 1 **THEN** Invalid Config (Must be exactly 1).
52
- - **IF** `layout` contains both 'Table' and 'Grid' **THEN** View Switcher is automatically enabled.
53
- - **IF** `columns` count > 5 **THEN** `customColumns.enabled` = `true`.
54
- - **IF** `columns` count <= 5 **THEN** `customColumns.enabled` = `false` (unless explicitly requested).
55
- - **IF** `type` is 'Grid' **THEN** `titleFieldId` is **REQUIRED**.
56
-
57
- ## Implementation Rules
58
- - **MUST** reference `entityPageId` to link rows/cards to the entity page.
59
- - **MUST** select max 3 columns initially for the table.
60
- - **MUST** use `tooltipContent` to explain complex column data.
61
- - **SHOULD** include a primary action with `type: 'update'` in Grid view to allow easy editing.
62
- - **NEVER** use `onRowClick` unless custom behavior (not entity page navigation) is explicitly required.
63
-
64
- ## Canonical Example
65
- ```typescript
66
- {
67
- type: 'collectionPage',
68
- // ... page props
69
- components: [
70
- {
71
- type: 'collection',
72
- entityPageId: 'pet-details', // Links to entity page
73
- collection: {
74
- collectionId: 'pets',
75
- entityTypeSource: 'cms'
76
- },
77
- layout: [
78
- {
79
- type: 'Table',
80
- table: {
81
- columns: [
82
- { id: 'name', name: 'Name', width: '200px', tooltipContent: 'Pet Name' },
83
- { id: 'breed', name: 'Breed', width: '150px' },
84
- { id: 'age', name: 'Age', width: '100px' }
85
- ],
86
- customColumns: { enabled: false }
87
- }
88
- },
89
- {
90
- type: 'Grid',
91
- grid: {
92
- item: {
93
- titleFieldId: 'name',
94
- subtitleFieldId: 'breed',
95
- imageFieldId: 'photo'
96
- }
97
- }
98
- }
99
- ]
100
- }
101
- ]
102
- }
103
- ```
@@ -1,76 +0,0 @@
1
- # Custom Actions Override Rules
2
-
3
- **REQUIRED**: After creating action files, you MUST update `page.tsx` to register them.
4
-
5
- ## Type Definitions
6
- ```typescript
7
- interface ResolvedAction {
8
- label: string;
9
- icon?: React.ReactElement;
10
- onClick: () => void | Promise<void>;
11
- disabled?: boolean;
12
- hidden?: boolean;
13
- }
14
-
15
- // Action Resolver Signature
16
- type CustomActionResolver = (params: {
17
- item: any;
18
- selectedItems?: any[];
19
- }) => ResolvedAction;
20
- ```
21
-
22
- ## Configuration Schema
23
- ```json
24
- {
25
- "actions": [
26
- {
27
- "type": "custom",
28
- "id": "myAction" // Matches override key
29
- }
30
- ]
31
- }
32
- ```
33
-
34
- ## Validation Logic
35
- - **IF** `type` is `"custom"` **THEN** `id` MUST match key in `actions` override.
36
- - **IF** action is async **THEN** `onClick` SHOULD return a Promise.
37
- - **IF** action requires selection **THEN** check `selectedItems`.
38
-
39
- ## Implementation Rules
40
- - **MUST** be placed in `components/actions/` folder.
41
- - **MUST** use `.tsx` extension if the file contains JSX (icons, React elements). Use `.ts` only for pure logic files.
42
- - **MUST** export `useActions` hook from `components/actions/index.tsx`.
43
- - **MUST** return `ResolvedAction` object.
44
- - **MUST** handle errors (use `try/catch` or `errorHandler` for Wix APIs).
45
- - **APPLIES TO** all custom action types: actionCell, collectionPageActions, onRowClick, bulkActions.
46
- - **NEVER** place action resolvers directly in page.tsx or overrides.tsx - always use components/actions/ folder.
47
-
48
- ## Canonical Example
49
- ```tsx
50
- // components/actions/myAction.tsx (use .tsx when file contains JSX like icons)
51
- export const myAction = ({ item }) => ({
52
- label: 'Approve',
53
- icon: <Check />,
54
- onClick: async () => {
55
- await approveItem(item.id);
56
- }
57
- });
58
-
59
- // components/actions/index.tsx
60
- import { myAction } from './myAction';
61
- export const useActions = () => ({ myAction });
62
- ```
63
-
64
- ## page.tsx Registration (REQUIRED)
65
-
66
- **CRITICAL: PRESERVE EXISTING OVERRIDES** - Do NOT remove existing overrides. ADD this new one alongside them.
67
-
68
- ```tsx
69
- // 1. Add import (keep all existing imports)
70
- import { useActions } from './components/actions';
71
-
72
- // 2. Add hook call (keep all existing hook calls)
73
- const actions = useActions();
74
-
75
- // 3. Add actions to PatternsWizardOverridesProvider value (keep ALL existing overrides)
76
- ```