@wix/agent-skills 1.16.2 → 1.17.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 (58) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +134 -120
  3. package/skills/wix-app/references/EMBEDDED_SCRIPT.md +6 -0
  4. package/skills/wix-app/references/SITE_PLUGIN.md +2 -2
  5. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +2 -2
  6. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +182 -99
  7. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +92 -47
  8. package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +15 -6
  9. package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +275 -0
  10. package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +29 -42
  11. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +153 -449
  12. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +66 -19
  13. package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +53 -158
  14. package/skills/wix-app/references/editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md +78 -0
  15. package/skills/wix-app/references/editor-react-component/FUNCTION-HANDLERS.md +42 -134
  16. package/skills/wix-app/references/editor-react-component/MANIFEST-ERRORS.md +27 -0
  17. package/skills/wix-app/references/editor-react-component/PARTS.md +45 -24
  18. package/skills/wix-app/references/editor-react-component/PROPS-VS-CSS.md +63 -179
  19. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +79 -163
  20. package/skills/wix-app/references/editor-react-component/SITE-CONTEXT-HOOKS.md +36 -21
  21. package/skills/wix-app/references/editor-react-component/SSR.md +30 -99
  22. package/skills/wix-base44-connector/SKILL.md +34 -17
  23. package/skills/wix-base44-connector/scripts/utils.js +33 -25
  24. package/skills/wix-headless/entry/bootstrap.mjs +9 -2
  25. package/skills/wix-headless/references/SDK_HANDOFF.md +1 -1
  26. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +42 -23
  27. package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +10 -8
  28. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +27 -24
  29. package/skills/wix-headless/references/managed/AUTHENTICATION.md +5 -0
  30. package/skills/wix-manage/SKILL.md +14 -2
  31. package/skills/wix-manage/references/bookings/booking-system-integration-gaps.md +20 -13
  32. package/skills/wix-manage/references/bookings/create-class-service.md +1 -1
  33. package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +24 -11
  34. package/skills/wix-manage/references/cms/cms-ecommerce-catalog-integration.md +5 -5
  35. package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +182 -5
  36. package/skills/wix-manage/references/seo/manage-seo-tags.md +315 -0
  37. package/skills/wix-manage/references/seo/manage-url-redirects.md +250 -0
  38. package/skills/wix-manage/references/sites/query-sites.md +72 -161
  39. package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +5 -6
  40. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +13 -9
  41. package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +10 -7
  42. package/skills/wix-vibe-headless/platforms/base44.md +13 -10
  43. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +2 -0
  44. package/skills/wix-vibe-headless/references/bookings/app/rest/wix-bookings-checkout.js +9 -8
  45. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +4 -1
  46. package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartDrawer.jsx +23 -11
  47. package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +1 -1
  48. package/skills/wix-vibe-headless/references/restaurants/app/rest/wix-restaurants-ordering.js +29 -31
  49. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +15 -8
  50. package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +37 -38
  51. package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +2 -2
  52. package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-cart.js +35 -35
  53. package/skills/wix-app/references/editor-react-component/A11Y-REVIEW-REFERENCE.md +0 -172
  54. package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +0 -143
  55. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +0 -484
  56. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +0 -225
  57. package/skills/wix-app/references/editor-react-component/EDIT-FLOW.md +0 -6
  58. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +0 -95
@@ -0,0 +1,275 @@
1
+ # Component Contract
2
+
3
+ Use this reference when defining props, defaults, named-part wiring, complex data,
4
+ or internal file boundaries.
5
+
6
+ ## Contents
7
+
8
+ - [Public Props Contract](#public-props-contract)
9
+ - [Numeric Range Constraints](#numeric-range-constraints)
10
+ - [Named Parts and `elementProps`](#named-parts-and-elementprops)
11
+ - [Content and Data](#content-and-data)
12
+ - [Active-Item Components](#active-item-components)
13
+ - [Defaults and Resources](#defaults-and-resources)
14
+ - [Internal File Splitting](#internal-file-splitting)
15
+ - [Checklist](#checklist)
16
+
17
+ ## Public Props Contract
18
+
19
+ Keep identity and platform contracts together with component-specific data and
20
+ behavior. Do not add `children` unless the component is explicitly a container.
21
+
22
+ Use this shape:
23
+
24
+ ```ts
25
+ import type { A11y, Direction } from '@wix/editor-react-types';
26
+
27
+ export type PlanCardProps = {
28
+ id?: string;
29
+ className?: string;
30
+ direction?: Direction;
31
+ a11y?: A11y;
32
+
33
+ heading?: string;
34
+ plans?: Array<Plan>;
35
+ onClick?: (event: React.MouseEvent) => void;
36
+
37
+ elementProps?: {
38
+ cta?: { className?: string; href?: string };
39
+ };
40
+ };
41
+ ```
42
+
43
+ Rules:
44
+
45
+ - Route all ARIA attributes through `a11y`; do not add individual `ariaLabel`,
46
+ `role`, or similar props.
47
+ - Expose only content and behavior that the site owner controls. Keep derived
48
+ values internal.
49
+ - Add only callbacks required by the component specification. Use supported SDK
50
+ event names and types for public callbacks; keep implementation-only handlers
51
+ internal.
52
+ - Use `Array<T>`, not `T[]`, for exported arrays.
53
+
54
+ ## Numeric Range Constraints
55
+
56
+ For a new or changed numeric prop, use inline `@min` and `@max` JSDoc tags when
57
+ the value has a fixed domain. Manifest generation reads the tags; no extension
58
+ override is needed.
59
+
60
+ ```ts
61
+ export type RatingProps = {
62
+ /** @min 0 @max 5 */
63
+ rating: number;
64
+ };
65
+ ```
66
+
67
+ Use fixed bounds for ratings, percentages, playback speed, columns, and similar
68
+ domains. Omit them for arbitrary counts, free-form prices, or an active index
69
+ whose upper bound depends on the current collection.
70
+
71
+ ## Named Parts and `elementProps`
72
+
73
+ Treat an independently editable inner element as a named part, then apply one
74
+ consistent wiring rule:
75
+
76
+ - The elected root receives top-level `id`, `className`, `direction`, and `a11y`;
77
+ it has no `elementProps` entry.
78
+ - Every named inner part has an `elementProps` entry, even when `className` is
79
+ the only injected field it currently needs.
80
+ - Structural or decorative non-parts have no `elementProps` entry and use only a
81
+ CSS Module class.
82
+
83
+ On a raw HTML element, spread the entry and explicitly merge its injected
84
+ `className`. Keep the entry key short while prefixing the global class with the
85
+ component name.
86
+
87
+ ```tsx
88
+ <a
89
+ {...elementProps?.cta}
90
+ className={classNames(
91
+ 'plan-card-cta',
92
+ styles.cta,
93
+ elementProps?.cta?.className,
94
+ )}
95
+ >
96
+ {label}
97
+ </a>
98
+ ```
99
+
100
+ When a named part renders another component built with this skill, spread the
101
+ entry and let that component merge its incoming `className` on its root.
102
+
103
+ ```tsx
104
+ <PlanRow {...elementProps?.planRow} item={plan} />
105
+ ```
106
+
107
+ Do not merge the same class at both the call site and the sub-component root.
108
+
109
+ ## Content and Data
110
+
111
+ ### Derived Values
112
+
113
+ Compute a value internally when a small pure expression can derive it from
114
+ props or state. For example, expose `price` and `quantity`; compute `subtotal`.
115
+ Use numeric types when arithmetic is required.
116
+
117
+ ### Data-Driven Components
118
+
119
+ Export named content props rather than `children` for leaf components:
120
+
121
+ - text: `label`, `title`, `placeholder`
122
+ - media: `image`, `video`, `icon`
123
+ - links: `link`, `href`
124
+ - collections: `items`, `options`, `menuItems`
125
+
126
+ Internal sub-components may still use `children` for composition.
127
+
128
+ ### Container Components
129
+
130
+ Use `React.ReactNode` only when the specification defines a container or slot
131
+ that accepts arbitrary nested components. Put `dir="ltr"` on the element that
132
+ renders each `ReactNode` value so nested content does not inherit the component's
133
+ direction.
134
+
135
+ ### Array Props
136
+
137
+ Array elements must be objects with named keys. This provides stable identity,
138
+ semantic field names, and room for non-breaking extension.
139
+
140
+ ```ts
141
+ type GalleryProps = {
142
+ images: Array<{ id: string; image: Image; caption?: string }>;
143
+ tags: Array<{ id: string; label: string }>;
144
+ };
145
+ ```
146
+
147
+ Do not export arrays of primitives, leaf Wix data types, or nested arrays:
148
+
149
+ ```ts
150
+ // Avoid:
151
+ // Array<string>
152
+ // Array<Image>
153
+ // Array<Array<Item>>
154
+ // Array<{ items: Array<Image> }>
155
+ ```
156
+
157
+ The parent owns the array. Item sub-components receive one item rather than
158
+ redeclaring the collection. Use a stable item identifier as the React key; do
159
+ not synthesize identity from the array index when stable identity is available.
160
+
161
+ ### Active-Item Components
162
+
163
+ Apply this contract when an array-driven UI shows one item body at a time, such
164
+ as tabs, slides, or steps. Skip it for always-visible lists, multi-select UIs,
165
+ and multi-expand accordions.
166
+
167
+ - Give every item a `name: string`; Studio uses `name` for hat-selector labels.
168
+ - Pair the array prop with `ActiveItemIndex<'arrayPropName'>` from
169
+ `@wix/react-component-utils`. The type argument must exactly match the array
170
+ prop name, and `defaultProps` must initialize the index to `0`.
171
+ - Render every body with `.map()`. Mark the active body with a prefixed
172
+ `--active` state class, hide inactive bodies with functional CSS visibility,
173
+ and apply `aria-hidden` and `inert` to inactive content.
174
+ - Provide keyboard navigation between triggers and the matching ARIA pattern.
175
+
176
+ ```ts
177
+ import type { A11y, Direction } from '@wix/editor-react-types';
178
+ import type { ActiveItemIndex } from '@wix/react-component-utils';
179
+
180
+ export type Step = { id: string; name: string; body: string };
181
+
182
+ export type StepsProps = {
183
+ id?: string;
184
+ className?: string;
185
+ direction?: Direction;
186
+ a11y?: A11y;
187
+ steps: Array<Step>;
188
+ activeItem: ActiveItemIndex<'steps'>;
189
+ };
190
+
191
+ export const defaultProps = {
192
+ steps: [{ id: 'first', name: 'Step 1', body: 'First step' }],
193
+ activeItem: 0,
194
+ } satisfies Omit<StepsProps, 'id' | 'className'>;
195
+ ```
196
+
197
+ ### Wix Data Types
198
+
199
+ Use types such as `Image`, `Link`, `Video`, `Audio`, `VectorArt`, and `RichText`
200
+ from `@wix/editor-react-types`. Inspect
201
+ `node_modules/@wix/react-component-schema/dist/editor-react-types.d.ts` when you
202
+ need the supported schema types.
203
+
204
+ ## Defaults and Resources
205
+
206
+ Export `defaultProps` from `<component-name>.props.ts`. Both `component.tsx` and
207
+ the extension consume this object; do not duplicate fallback values in JSX.
208
+
209
+ Rendered media and runtime data must come from Wix-hosted services, local
210
+ bundled assets, or values supplied through props. Do not silently introduce an
211
+ external host or third-party runtime dependency.
212
+
213
+ For an `Image` default, populate only `uri`, `url`, and `alt`. Let the editor
214
+ populate dimensions and focal-point metadata after the site owner chooses an
215
+ image.
216
+
217
+ ```ts
218
+ export const defaultProps = {
219
+ image: {
220
+ url: 'https://static.wixstatic.com/media/11062b_2f97b87dcea2446fa48e9ad9c5457ae1~mv2.jpg',
221
+ uri: '11062b_2f97b87dcea2446fa48e9ad9c5457ae1~mv2.jpg',
222
+ alt: 'Tropical beach viewed from above',
223
+ },
224
+ } as const satisfies Omit<ExampleComponentProps, 'id' | 'className'>;
225
+ ```
226
+
227
+ Use distinct Wix-hosted defaults for multiple image slots. Keep fallback data in
228
+ `defaultProps` so rendering reads the resolved prop instead of hardcoding a
229
+ second fallback in JSX.
230
+
231
+ Use this pool in order, cycling only when more than five defaults are needed:
232
+
233
+ | # | `fileName` | Description |
234
+ | --- | --- | --- |
235
+ | 1 | `11062b_2f97b87dcea2446fa48e9ad9c5457ae1~mv2.jpg` | Tropical beach aerial |
236
+ | 2 | `11062b_73f31c7e7d3544c69dc8ecd8d34c5717~mv2.jpg` | Dead Sea landscape |
237
+ | 3 | `11062b_3682ebfcb08e4da5b3168b62819a1e68~mv2.jpg` | Palm tree sunset |
238
+ | 4 | `11062b_45e67783d39c4963ab9e4fc418173233~mv2.jpg` | Abstract pink waves |
239
+ | 5 | `11062b_4c11f014b0d04948b2e6f554076bc40a~mv2.jpg` | Coastal village aerial |
240
+
241
+ For one image, use entry 1. For multiple slots, use a different entry for each
242
+ slot so the defaults are visually distinct.
243
+
244
+ ## Internal File Splitting
245
+
246
+ Split a logical, independently understandable unit when doing so makes the main
247
+ component easier to read or test. Keep internal files within the scaffolded
248
+ component folder and use `.module.css`, matching the package convention.
249
+
250
+ ```text
251
+ component-name/
252
+ ├── components/
253
+ │ └── plan-row/
254
+ │ ├── plan-row.tsx
255
+ │ └── plan-row.module.css
256
+ ├── hooks/
257
+ │ └── use-playback.ts
258
+ ├── component-name.props.ts
259
+ ├── component-name.tsx
260
+ └── component-name.module.css
261
+ ```
262
+
263
+ Do not extract tiny fragments merely to satisfy a line-count threshold.
264
+
265
+ ## Checklist
266
+
267
+ - [ ] Identity, direction, and accessibility contracts are present.
268
+ - [ ] Props contain authored data or stable behavior; derived values stay internal.
269
+ - [ ] New or changed fixed-domain numeric props use `@min` and `@max`.
270
+ - [ ] Every named inner part has `elementProps` wiring and merged classes.
271
+ - [ ] Leaf components avoid exported `children`.
272
+ - [ ] Array elements are named objects with stable identity.
273
+ - [ ] One-body-visible arrays use the active-item contract and render all bodies.
274
+ - [ ] Defaults have one source of truth in the props file.
275
+ - [ ] Resources are Wix-hosted, prop-supplied, or locally bundled.
@@ -1,57 +1,44 @@
1
- # Component Preview (`component.preview.tsx`)
1
+ # Editor Preview Entry
2
2
 
3
- Rules and patterns for the editor-specific entry point that every Editor React
4
- component ships alongside its main `component.tsx`.
3
+ Use this reference when `component.preview.tsx` must behave differently in
4
+ Harmony Editor design mode than on the live site.
5
5
 
6
- ---
6
+ ## Preserve the Generated Contract
7
7
 
8
- ## What it is
8
+ The Wix CLI scaffold generates `component.preview.tsx` and wires its URL into
9
+ the extension's editor resource. It includes `withDefaults`,
10
+ `withFallbackPlaceholder`, required-data fields, and the root class name.
9
11
 
10
- `component.preview.tsx` is the editor-specific entry point for a component. The
11
- Wix CLI loads it **instead of** `component.tsx` when rendering the component
12
- inside the Harmony Editor. It is generated automatically by the scaffold as a
13
- passthrough that forwards all props unchanged:
12
+ Do not repeat or replace that boilerplate. Keep the generated wrappers and
13
+ metadata, and change only the preview component when editor behavior must differ
14
+ from live behavior.
14
15
 
15
- ```tsx
16
- const MyComponentPreview = (props: React.ComponentProps<typeof MyComponent>) => (
17
- <MyComponent {...props} />
18
- );
19
- ```
20
-
21
- The extension file is also pre-wired to load it — no manual wiring is needed:
22
-
23
- ```ts
24
- import componentPreviewUrl from './component.preview.tsx?url';
25
-
26
- resources: {
27
- client: { componentUrl },
28
- editor: { componentUrl: componentPreviewUrl },
29
- },
30
- ```
16
+ ## Detect Editor Design Mode
31
17
 
32
- ---
33
-
34
- ## `useIsEditMode()`
35
-
36
- When you need to distinguish **editor design mode** from **editor preview mode**,
37
- use `useIsEditMode()` from `@wix/react-component-utils`:
18
+ Use `useIsEditMode()` from `@wix/react-component-utils`:
38
19
 
39
20
  ```tsx
40
- import { useIsEditMode } from '@wix/react-component-utils';
41
-
42
21
  const isEditMode = useIsEditMode();
43
- // true → editor is in design mode
44
- // false → editor is in preview mode
45
22
  ```
46
23
 
47
- `@wix/react-component-utils` is already a base dependency — no additional install needed.
24
+ - `true`: editor design mode
25
+ - `false`: editor preview mode or live-equivalent rendering
26
+
27
+ Call the hook inside a React component, never at module scope or conditionally.
28
+
29
+ ## Modify Only When Needed
48
30
 
49
- ---
31
+ Keep the generated passthrough unchanged unless the component requires
32
+ editor-specific runtime behavior. The primary case is suppressing autoplay,
33
+ timers, or network activity while a site owner is designing.
50
34
 
51
- ## When to modify it
35
+ For autoplaying components, force autoplay off in editor design mode and keep
36
+ the live/preview prop values unchanged.
52
37
 
53
- Modify `component.preview.tsx` whenever the component needs to behave differently
54
- inside the editor than it does on the live site. The most common case is
55
- suppressing autoplay so animations don't run while the site owner is designing.
38
+ ## Checklist
56
39
 
57
- → See [`ANIMATED-COMPONENTS.md`](ANIMATED-COMPONENTS.md) §4 for the autoplay suppression pattern.
40
+ - [ ] Generated defaults and fallback-placeholder behavior remain intact.
41
+ - [ ] Required data fields and root class metadata are unchanged.
42
+ - [ ] The extension still loads the preview URL as its editor resource.
43
+ - [ ] `useIsEditMode()` is called inside a component.
44
+ - [ ] Live/preview behavior still receives the site owner's original props.