@wix/agent-skills 1.13.0 → 1.15.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/README.md +4 -1
- package/package.json +1 -1
- package/skills/README.md +23 -0
- package/skills/wix-app/SKILL.md +10 -2
- package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
- package/skills/wix-app/references/CODE_QUALITY.md +1 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
- package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +23 -9
- package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
- package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
- package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
- package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
- package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
- package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
- package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
- package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
- package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
- package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
- package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
- package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +17 -105
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +15 -15
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
- package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
- package/skills/wix-auth/SKILL.md +12 -0
- package/skills/wix-auth/references/device-flow.md +140 -0
- package/skills/wix-docs/SKILL.md +188 -0
- package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
- package/skills/wix-docs/references/EXTRACTING.md +120 -0
- package/skills/wix-headless/SKILL.md +84 -130
- package/skills/wix-headless/entry/bootstrap.mjs +93 -0
- package/skills/wix-headless/entry/skill.md +78 -0
- package/skills/wix-headless/references/AI_FEATURES.md +178 -0
- package/skills/wix-headless/references/CAPABILITIES.md +84 -0
- package/skills/wix-headless/references/DISCOVERY.md +34 -56
- package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
- package/skills/wix-headless/references/FEEDBACK.md +118 -0
- package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +97 -0
- package/skills/wix-headless/references/SEED.md +44 -188
- package/skills/wix-headless/references/SETUP.md +32 -103
- package/skills/wix-headless/references/astro.md +98 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +173 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
- package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
- package/skills/wix-headless/references/inline-recipes/setup-bookings.md +228 -0
- package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
- package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +176 -0
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +153 -0
- package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +161 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +117 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
- package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
- package/skills/wix-headless/references/managed/CONNECT.md +74 -0
- package/skills/wix-headless/references/managed/CREATE.md +130 -0
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +57 -0
- package/skills/wix-headless/references/non-astro.md +59 -0
- package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
- package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +7 -0
- package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +63 -0
- package/skills/wix-manage/SKILL.md +24 -1
- package/skills/wix-manage/references/analytics/query-site-analytics.md +241 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +265 -0
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +436 -0
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +209 -0
- package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +51 -0
- package/skills/wix-vibe-headless/SKILL.md +136 -0
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
- package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +153 -0
- package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
- package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +215 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
- package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
- package/skills/wix-vibe-headless/references/events/wix-events-browse.js +135 -0
- package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
- package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
- package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +194 -0
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
- package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
- package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +155 -0
- package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
- package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +142 -0
- package/skills/wix-headless/references/BUILD-astro.md +0 -244
- package/skills/wix-headless/references/BUILD-own-build.md +0 -167
- package/skills/wix-headless/references/BUILD.md +0 -105
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
- package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
- package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
- package/skills/wix-headless/references/PLAN-connect.md +0 -19
- package/skills/wix-headless/references/PLAN-create.md +0 -17
- package/skills/wix-headless/references/PLAN.md +0 -92
- package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
- package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
- package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
- package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
- package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
- package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
- package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
- package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
- package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
- package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
- package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
- package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
- package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
- package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
- package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
- package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
- package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
- package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
- package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
- package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
- package/skills/wix-headless/references/astro/templates/Footer.astro +0 -27
- package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
- package/skills/wix-headless/references/astro/templates/Navigation.astro +0 -38
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
- package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
- package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
- package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
- package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
- package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
- package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
- package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
- package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
- package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
- package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
- package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
- package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
- package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
- package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
- package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
- package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
- package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
- package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
- package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
- package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
- package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
- package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
- package/skills/wix-headless/references/astro/templates/global.css +0 -288
- package/skills/wix-headless/references/astro/templates/index.astro +0 -56
- package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
- package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
- package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
- package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
- package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
- package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
- package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
- package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
- package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
- package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
- package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
- package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
- package/skills/wix-headless/references/bookings/FLOW.md +0 -246
- package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
- package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
- package/skills/wix-headless/references/commands/known-apps.json +0 -6
- package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
- package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
- package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
- package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
- package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
- package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
- package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
- package/skills/wix-headless/references/seed-recipes.md +0 -49
- package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
- package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
- package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
- package/skills/wix-headless/references/shared/STYLING.md +0 -141
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
- package/skills/wix-headless/references/verticals/_schema.json +0 -74
- package/skills/wix-headless/references/verticals/_schema.md +0 -95
- package/skills/wix-headless/references/verticals/blog.md +0 -31
- package/skills/wix-headless/references/verticals/bookings.md +0 -41
- package/skills/wix-headless/references/verticals/cms.md +0 -30
- package/skills/wix-headless/references/verticals/ecom.md +0 -25
- package/skills/wix-headless/references/verticals/forms.md +0 -26
- package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
- package/skills/wix-headless/references/verticals/stores.md +0 -33
- package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
- package/skills/wix-headless/scripts/compose.mjs +0 -525
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
- package/skills/wix-headless/scripts/flatten.sh +0 -61
- package/skills/wix-headless/scripts/generate-images.mjs +0 -242
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -148
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
- package/skills/wix-headless/scripts/scaffold.sh +0 -139
- package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
- package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
- package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
- package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
- package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# Phase 3 Components — Gift Cards
|
|
2
|
-
|
|
3
|
-
This is the **components** portion of the gift-cards **merged build agent** (the build wave). Your agent writes the runtime probe utility, the buy-flow React island, and scoped CSS **first**, then its pages (`/gift-cards` route + Navigation/index patches) — so the island is on disk before the page mounts it. Because the page side patches the shared shells, the whole gift-cards agent runs in the build wave's **serialized shell chain** (`BUILD-astro.md` § "Step 4.5").
|
|
4
|
-
|
|
5
|
-
## Scope
|
|
6
|
-
|
|
7
|
-
Files this agent OWNS:
|
|
8
|
-
|
|
9
|
-
- `src/utils/gift-cards.ts` — runtime probe of the dashboard's eGift Card template + types
|
|
10
|
-
- `src/components/GiftCardPurchase.tsx` — React island; recipient form + variant pills + add-to-cart
|
|
11
|
-
- `src/styles/components-gift-cards.css` — scoped CSS for the form fields, amount pills, hero image frame, and home teaser
|
|
12
|
-
|
|
13
|
-
Files this agent MUST NOT touch:
|
|
14
|
-
- `src/utils/wix-image.ts`, `src/utils/analytics.ts` — shared utilities. Import from them; do not write copies.
|
|
15
|
-
- `src/components/AddToCartButton.tsx`, `src/components/CartBadge.tsx`, `src/components/CartView.tsx` — owned by stores/ecom; gift-cards uses `currentCart.addToCurrentCart` directly inside the buy-flow island, not via `AddToCartButton`.
|
|
16
|
-
- Any `.astro` page or layout — those are written by other scopes.
|
|
17
|
-
- `src/styles/global.css` — owned by designer foundation.
|
|
18
|
-
|
|
19
|
-
## Coordination: design tokens
|
|
20
|
-
|
|
21
|
-
Read the design tokens from `.wix/design-tokens.css` (on disk, gate-verified present before the wave). Reference token CSS variables (`var(--color-cream)`, `1.5rem`, etc.) from `components-gift-cards.css`.
|
|
22
|
-
|
|
23
|
-
## Critical rules
|
|
24
|
-
|
|
25
|
-
1. **`httpClient.fetchWithAuth` from `@wix/essentials`** — the JS SDK's gift-vouchers package only exposes redemption methods; the buy-template query is reachable only via REST.
|
|
26
|
-
2. **Module-level memoization** — hold one in-flight `Promise<GiftCardProduct | null>` at module scope so Navigation, home, and `/gift-cards` calls within the same request coalesce. The plugin's `discounts.ts` skips memoization for simplicity but the gift-card template is far more cacheable, so this pack pays the small cost.
|
|
27
|
-
3. **Return `null` on every failure** — non-2xx, empty `giftCardProducts[]`, network/JSON error. The page/nav/teaser callers branch on `null` to hide gracefully. Never throw.
|
|
28
|
-
4. **Hardcoded `WIX_GIFT_CARDS_APP_ID`** — `d80111c5-a0f4-47a8-b63a-65b54d774a27`. Captured from a real Wix-Editor order; not in the public registry. Export it as a named constant with a provenance comment so future maintainers can find the source.
|
|
29
|
-
5. **`wixGiftCardsAppNewCatalog: true`** in the cart `options` is mandatory — without it, the cart line item type is wrong and `ORDER_PAID` won't trigger gift-card issuance.
|
|
30
|
-
6. **No HTML comments in `.astro` frontmatter** — frontmatter is TypeScript; use `//` or `/* */`. (Not relevant to this scope's `.ts`/`.tsx` files but mentioned because gift-cards.ts is imported into `.astro` frontmatter elsewhere.)
|
|
31
|
-
|
|
32
|
-
## Template files
|
|
33
|
-
|
|
34
|
-
This scope uses **template files** instead of inline code. For each file below:
|
|
35
|
-
|
|
36
|
-
1. Read the template from `<Agent location>/templates/<filename>`
|
|
37
|
-
2. Write it to the project at the target path
|
|
38
|
-
3. Adapt CSS class names if the design tokens map them differently than the defaults
|
|
39
|
-
|
|
40
|
-
Do NOT modify logic, imports, or component structure.
|
|
41
|
-
|
|
42
|
-
## Implementation
|
|
43
|
-
|
|
44
|
-
### 1. `src/utils/gift-cards.ts`
|
|
45
|
-
|
|
46
|
-
Use template `templates/gift-cards.ts`.
|
|
47
|
-
|
|
48
|
-
Exports:
|
|
49
|
-
- `WIX_GIFT_CARDS_APP_ID` — string constant.
|
|
50
|
-
- `GiftCardImage`, `GiftCardPresetVariant`, `GiftCardProduct` — TypeScript interfaces.
|
|
51
|
-
- `getGiftCardProduct(): Promise<GiftCardProduct | null>` — memoized probe. Returns the first gift-card product or null on any failure.
|
|
52
|
-
|
|
53
|
-
The probe uses `httpClient.fetchWithAuth(ENDPOINT, { method: "POST", body: JSON.stringify({ query: { paging: { limit: 1 } } }) })`.
|
|
54
|
-
|
|
55
|
-
### 2. `src/components/GiftCardPurchase.tsx`
|
|
56
|
-
|
|
57
|
-
Use template `templates/GiftCardPurchase.tsx`.
|
|
58
|
-
|
|
59
|
-
Props: `{ product: GiftCardProduct }`.
|
|
60
|
-
|
|
61
|
-
State machine: `"idle" | "adding" | "added" | "error"`. Submit handler:
|
|
62
|
-
1. Validate selected `variantId`, `recipientFirstName`, `recipientEmail` (regex).
|
|
63
|
-
2. Call `currentCart.addToCurrentCart` with the catalogReference shape from gift-cards.md ("Wix Gift Card app reference data" section).
|
|
64
|
-
3. Dispatch `cart-updated` CustomEvent (so CartBadge updates).
|
|
65
|
-
4. `trackEvent("AddToCart", { … })` — fire-and-forget; same pattern as stores.
|
|
66
|
-
5. `window.location.href = "/cart"` on success.
|
|
67
|
-
|
|
68
|
-
Class names from contract:
|
|
69
|
-
- `.gift-card-form`, `.gift-card-fieldset`, `.gift-card-amounts`, `.gift-card-grid`, `.gift-card-field`, `.gift-card-field-wide`, `.gift-card-counter`, `.gift-card-error` — defined in `components-gift-cards.css`.
|
|
70
|
-
- `.option-label`, `.option-pill`, `.option-pill.selected` — shared across packs (also used by stores `ProductPurchase`).
|
|
71
|
-
- `.add-to-cart-btn` — shared with stores AddToCartButton; same brand styling.
|
|
72
|
-
|
|
73
|
-
### 3. `src/styles/components-gift-cards.css`
|
|
74
|
-
|
|
75
|
-
Use template `templates/components-gift-cards.css`.
|
|
76
|
-
|
|
77
|
-
Scoped styles for:
|
|
78
|
-
- Buy-form layout (grid, fields, counter, error message).
|
|
79
|
-
- `/gift-cards` page sections (`.gift-card-page`, `.gift-card-grid-wrap`, `.gift-card-hero-image`, `.gift-card-body`, `.gift-card-lede`, `.gift-card-fineprint`).
|
|
80
|
-
- Home teaser (`.gift-card-teaser`, `.gift-card-teaser-link`, `.gift-card-teaser-image`, `.gift-card-teaser-body`, `.gift-card-teaser-lede`).
|
|
81
|
-
|
|
82
|
-
The page-section and teaser styles live here (not inside the .astro `<style>` blocks) so the same separation as `components-stores.css` / `components-ecom.css` holds. The pages-scope agent imports this stylesheet via `Layout.astro`'s existing CSS chain (designer foundation already wires up the `components-*.css` import).
|
|
83
|
-
|
|
84
|
-
Use brand `@theme` utilities (`bg-cream`, `text-ink`, etc.) where natural; fall back to `var(--color-*)` directly (spacing is Tailwind's numeric scale — `gap-4`, `py-24`) when a property isn't covered. Do not introduce new design-token names.
|
|
85
|
-
|
|
86
|
-
## Return format
|
|
87
|
-
|
|
88
|
-
```json
|
|
89
|
-
{
|
|
90
|
-
"status": "complete",
|
|
91
|
-
"phase": "gift-cards-components",
|
|
92
|
-
"scope": "components",
|
|
93
|
-
"summary": "Wrote runtime probe util, GiftCardPurchase island, and scoped gift-cards CSS",
|
|
94
|
-
"data": {
|
|
95
|
-
"utils": ["gift-cards.ts"],
|
|
96
|
-
"islands": ["GiftCardPurchase.tsx"],
|
|
97
|
-
"scopedCssFile": "src/styles/components-gift-cards.css",
|
|
98
|
-
"globalContractClassesReferenced": ["addToCartButton"],
|
|
99
|
-
"scopedContractClassesReferenced": ["optionLabel", "optionPill"]
|
|
100
|
-
},
|
|
101
|
-
"files": [
|
|
102
|
-
"src/utils/gift-cards.ts",
|
|
103
|
-
"src/components/GiftCardPurchase.tsx",
|
|
104
|
-
"src/styles/components-gift-cards.css"
|
|
105
|
-
],
|
|
106
|
-
"errors": []
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Anti-patterns
|
|
111
|
-
|
|
112
|
-
| WRONG | CORRECT |
|
|
113
|
-
|-------|---------|
|
|
114
|
-
| Use `@wix/auto_sdk_ecom_gift-vouchers` to query the buy template | That SDK only exposes redemption — use `httpClient.fetchWithAuth` against the REST endpoint |
|
|
115
|
-
| Wrap `getGiftCardProduct()` in `auth.elevate(...)` | Visitor-scope is correct; elevation breaks the probe |
|
|
116
|
-
| Throw or log+rethrow on probe failure | Return `null`; callers gate the UI on null |
|
|
117
|
-
| Hardcode denomination amounts (€10, €25, etc.) | Always render from `product.presetVariants` |
|
|
118
|
-
| Skip `wixGiftCardsAppNewCatalog: true` in cart options | Required — without it the cart line is the wrong item type and `ORDER_PAID` does not issue a gift card |
|
|
119
|
-
| Write your own `wix-image.ts` / `analytics.ts` | Import from the shared utilities |
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Phase 4 Pages — Gift Cards
|
|
2
|
-
|
|
3
|
-
The **pages** portion of the gift-cards **merged build agent** (the build wave) — written *after* its `components`. Writes the `/gift-cards` route and patches `Navigation.astro` + `index.astro` at their declared markers. Because it patches the shared shells, the gift-cards agent runs in the build wave's **serialized shell chain** (one shell-patcher at a time — `BUILD-astro.md` § "Step 4.5"). The components outputs (`src/utils/gift-cards.ts`, `src/components/GiftCardPurchase.tsx`, `src/styles/components-gift-cards.css`) were written earlier in this same agent, so they're already on disk.
|
|
4
|
-
|
|
5
|
-
## Scope
|
|
6
|
-
|
|
7
|
-
Files this agent OWNS (writes fresh):
|
|
8
|
-
|
|
9
|
-
- `src/pages/gift-cards.astro` — landing page; redirects to `/` when probe returns null
|
|
10
|
-
|
|
11
|
-
Files this agent PATCHES (insert at marker, preserve everything else):
|
|
12
|
-
|
|
13
|
-
- `src/components/Navigation.astro` — insert "Gift Cards" link at `<!-- nav:links -->`
|
|
14
|
-
- `src/pages/index.astro` — insert home teaser at `<!-- home:gift-cards -->`
|
|
15
|
-
|
|
16
|
-
Files this agent MUST NOT touch:
|
|
17
|
-
- `src/utils/gift-cards.ts`, `src/components/GiftCardPurchase.tsx`, `src/styles/components-gift-cards.css` — Components scope.
|
|
18
|
-
- Any other vertical's nav/home contributions.
|
|
19
|
-
- `Layout.astro`, `global.css`, or any product/cart/checkout page.
|
|
20
|
-
|
|
21
|
-
## Critical rules
|
|
22
|
-
|
|
23
|
-
1. **Marker-based patching.** Read the shell file, locate the exact marker comment string (`<!-- nav:links -->` or `<!-- home:gift-cards -->`), insert your snippet immediately AFTER the marker line, preserve the marker line itself. See `references/shared/IMPLEMENTER.md` § "Contributing to shared files via markers".
|
|
24
|
-
2. **Inject the import + frontmatter call when patching.** When inserting at `<!-- nav:links -->` in `Navigation.astro`, also add `import { getGiftCardProduct } from "../utils/gift-cards";` and `const giftCardsEnabled = (await getGiftCardProduct()) !== null;` to the file's frontmatter (top of the file). Same for `index.astro`'s home teaser. Do NOT assume another vertical added them.
|
|
25
|
-
3. **SSR error guards.** Wrap `getGiftCardProduct()` calls in try/catch with safe fallback (`giftCardsEnabled = false` / `giftCardProduct = null`). See `references/shared/IMPLEMENTER.md` § "SSR error guards". Although the helper itself never throws, the guard cost is zero and protects against future regressions.
|
|
26
|
-
4. **Redirect rather than render** when the page-level probe returns null. `if (!product) return Astro.redirect("/", 302);` — same pattern as private/disabled-feature routes elsewhere.
|
|
27
|
-
5. **Memoization is per-request.** Navigation, home, and the page may all call `getGiftCardProduct()` on the same request — the helper coalesces them into one fetch. You do not need to thread the result through Astro context.
|
|
28
|
-
6. **No HTML comments in `.astro` frontmatter** — frontmatter is TypeScript; use `//` or `/* */`.
|
|
29
|
-
7. **Image rendering uses `resolveWixImageUrl`** — the gift-card product's `image` field is a Wix media object identical in shape to product/blog images. Import from `../utils/wix-image`.
|
|
30
|
-
|
|
31
|
-
## Template files
|
|
32
|
-
|
|
33
|
-
Snippets to insert at markers live as standalone template fragments. Read each, substitute any contract-class adaptations, paste at the marker.
|
|
34
|
-
|
|
35
|
-
- `templates/gift-cards.astro` — full landing page
|
|
36
|
-
- `templates/_nav-snippet.astro` — single line for `Navigation.astro` (the `{giftCardsEnabled && <a>...</a>}` expression)
|
|
37
|
-
- `templates/_home-teaser-snippet.astro` — multi-line block for `index.astro` (the `{giftCardProduct && <section>...</section>}` block)
|
|
38
|
-
|
|
39
|
-
## Implementation
|
|
40
|
-
|
|
41
|
-
### 1. `src/pages/gift-cards.astro`
|
|
42
|
-
|
|
43
|
-
Use template `templates/gift-cards.astro`.
|
|
44
|
-
|
|
45
|
-
Frontmatter:
|
|
46
|
-
```astro
|
|
47
|
-
---
|
|
48
|
-
import Layout from "../layouts/Layout.astro";
|
|
49
|
-
import GiftCardPurchase from "../components/GiftCardPurchase.tsx";
|
|
50
|
-
import { getGiftCardProduct } from "../utils/gift-cards";
|
|
51
|
-
import { resolveWixImageUrl } from "../utils/wix-image";
|
|
52
|
-
|
|
53
|
-
const product = await getGiftCardProduct();
|
|
54
|
-
if (!product) return Astro.redirect("/", 302);
|
|
55
|
-
|
|
56
|
-
const heroImage = resolveWixImageUrl(product.image, 800, 800);
|
|
57
|
-
---
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Body: hero image + name + description + `<GiftCardPurchase client:load product={product} />` + fineprint paragraph. All page-level CSS is already shipped via `components-gift-cards.css` (Components scope) — do not duplicate styles inside the `.astro` file's `<style>` block.
|
|
61
|
-
|
|
62
|
-
### 2. Patch `src/components/Navigation.astro`
|
|
63
|
-
|
|
64
|
-
1. Read the file.
|
|
65
|
-
2. Add to frontmatter (above the `---` close): `import { getGiftCardProduct } from "../utils/gift-cards"; const giftCardsEnabled = (await getGiftCardProduct()) !== null;` (split across two lines as needed).
|
|
66
|
-
3. Locate the line containing `<!-- nav:links -->`. Insert immediately after it:
|
|
67
|
-
```astro
|
|
68
|
-
{giftCardsEnabled && <a href="/gift-cards">Gift Cards</a>}
|
|
69
|
-
```
|
|
70
|
-
4. If other verticals (stores, blog, forms) already inserted at the same marker, preserve every existing line — your snippet appends.
|
|
71
|
-
|
|
72
|
-
### 3. Patch `src/pages/index.astro`
|
|
73
|
-
|
|
74
|
-
1. Read the file.
|
|
75
|
-
2. Add to frontmatter:
|
|
76
|
-
```astro
|
|
77
|
-
import { getGiftCardProduct } from "../utils/gift-cards";
|
|
78
|
-
import { resolveWixImageUrl } from "../utils/wix-image";
|
|
79
|
-
|
|
80
|
-
const giftCardProduct = await getGiftCardProduct();
|
|
81
|
-
const giftCardImage = giftCardProduct
|
|
82
|
-
? resolveWixImageUrl(giftCardProduct.image, 800, 600)
|
|
83
|
-
: null;
|
|
84
|
-
```
|
|
85
|
-
(`resolveWixImageUrl` import may already be present from the stores patcher — if so, do not re-import.)
|
|
86
|
-
3. Locate the line containing `<!-- home:gift-cards -->`. Insert the teaser snippet immediately after it (see `templates/_home-teaser-snippet.astro`).
|
|
87
|
-
|
|
88
|
-
## Verification
|
|
89
|
-
|
|
90
|
-
After writing/patching, grep the project to confirm:
|
|
91
|
-
- `Navigation.astro` contains both the marker and the new link expression.
|
|
92
|
-
- `index.astro` contains both the marker and the new `<section class="gift-card-teaser">` block.
|
|
93
|
-
- `/gift-cards.astro` exists and references `GiftCardPurchase` (Components scope's island).
|
|
94
|
-
|
|
95
|
-
## Return format
|
|
96
|
-
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"status": "complete",
|
|
100
|
-
"phase": "gift-cards-pages",
|
|
101
|
-
"scope": "pages",
|
|
102
|
-
"summary": "Wrote /gift-cards page; patched Navigation + home with conditional gift-card surfaces",
|
|
103
|
-
"data": {
|
|
104
|
-
"pageWritten": true,
|
|
105
|
-
"navigationPatched": true,
|
|
106
|
-
"homePatched": true,
|
|
107
|
-
"markersFound": ["<!-- nav:links -->", "<!-- home:gift-cards -->"]
|
|
108
|
-
},
|
|
109
|
-
"files": [
|
|
110
|
-
"src/pages/gift-cards.astro",
|
|
111
|
-
"src/components/Navigation.astro",
|
|
112
|
-
"src/pages/index.astro"
|
|
113
|
-
],
|
|
114
|
-
"errors": []
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
If a marker is missing, return `status: "partial"` with `errors: [{ code: "MARKER_NOT_FOUND", file: "<path>", marker: "<marker>" }]`. Do NOT invent your own insertion point — that signals the designer foundation didn't scaffold the shell correctly and should be fixed upstream.
|
|
119
|
-
|
|
120
|
-
## Anti-patterns
|
|
121
|
-
|
|
122
|
-
| WRONG | CORRECT |
|
|
123
|
-
|-------|---------|
|
|
124
|
-
| Render the page when probe returns null | `Astro.redirect("/", 302)` |
|
|
125
|
-
| Skip the import-injection step (assume another vertical added `getGiftCardProduct`) | Always inject the import + the `await` call when patching, scoped to the file you're touching |
|
|
126
|
-
| Replace the marker comment with the inserted snippet | Insert AFTER the marker; preserve the marker line |
|
|
127
|
-
| Move CSS into `<style>` blocks inside `.astro` files | Page/teaser CSS lives in `components-gift-cards.css` (Components scope) |
|
|
128
|
-
| Hardcode `<title>"Gift Cards"</title>` | Use `title={\`${product.name}\`}` so the dashboard owner controls naming |
|
|
129
|
-
| Conditionally re-render the page when the app is enabled later | The Astro page is server-rendered each request — the probe runs every time, so dashboard changes are picked up without rebuild |
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
# Phase 3 Components — Back in Stock (Stores)
|
|
2
|
-
|
|
3
|
-
The stores `components` scope writes the TSX/util files; the CSS rules ship in the **pre-copied** `components-stores.css` template (no agent authors them). The matching page wiring lives in `PRODUCT_PAGES.md` (SSR probe import + new props on `<ProductPurchase>`). Both the components and that page wiring run inside the **same stores merged build agent** (the build wave), components first.
|
|
4
|
-
|
|
5
|
-
## Scope
|
|
6
|
-
|
|
7
|
-
Files written for back-in-stock, by scope:
|
|
8
|
-
|
|
9
|
-
**`components` scope** (see `./SHARED_WIRING.md`):
|
|
10
|
-
- `src/components/BackInStockForm.tsx` — React island that posts via `@wix/ecom`'s `backInStockNotifications.createBackInStockNotificationRequest`
|
|
11
|
-
|
|
12
|
-
**Pre-copied by the orchestrator** (do NOT author — same treatment as `categories.ts`):
|
|
13
|
-
- `src/utils/back-in-stock.ts` — SSR-elevated probe of the Wix back-in-stock service, plus the canonical Stores app id constant. Pre-copied into the project in the build-wave pre-batch (BUILD-astro.md § "Step 4.5"). **Import** `getBackInStockEnabled`/the app-id constants from `../utils/back-in-stock`; never `Write` it yourself (racing the pre-copy trips the harness staleness guard).
|
|
14
|
-
|
|
15
|
-
**`components-css` scope** (see `./COMPONENTS_CSS.md`):
|
|
16
|
-
- `src/styles/components-stores.css` — appends the back-in-stock form CSS rules at the end of the file (see § 3 below)
|
|
17
|
-
|
|
18
|
-
This file is read by both scopes. Sections covering the SDK / probe / form island are for the `components` scope; § 3 (CSS append) is for the `components-css` scope.
|
|
19
|
-
|
|
20
|
-
## Critical rules
|
|
21
|
-
|
|
22
|
-
These come from live trials on Catalog-V3 sites. Encode them verbatim — none of them are in the public docs.
|
|
23
|
-
|
|
24
|
-
1. **Two app ids — pick the right one.**
|
|
25
|
-
- The Wix Stores **install** app id is `215238eb-22a5-4c36-9e7b-e7c08025e04e` (used in `catalogReference.appId` for cart adds, app install, `Phase 1`).
|
|
26
|
-
- The Wix Stores **back-in-stock** app id is `1380b703-ce81-ff05-f115-39571d94dfcd` (the Stores sub-page registration id).
|
|
27
|
-
- The back-in-stock service rejects `215238eb-…` (`428 NOT_SUPPORTED_APP_DEF_ID` on `start-collecting`, `428 REQUEST_COLLECTION_DISABLED` on the create endpoint) and accepts `1380b703-…`. Both are correct in their own contexts; do not unify them.
|
|
28
|
-
|
|
29
|
-
2. **Bare-fields rule for the SDK subscribe call.** `backInStockNotifications.createBackInStockNotificationRequest(request, itemDetails)` throws an opaque `TypeError: Failed to construct 'URL': Invalid URL` when the optional `request.itemUrl` or `itemDetails.image` fields are present, even with browser-valid URLs. Send only the four required fields: `catalogReference`, `email`, `name`, `price`. The notification email and the dashboard view both work without them.
|
|
30
|
-
|
|
31
|
-
3. **Numeric price only.** `itemDetails.price` must be a numeric string (e.g. `"385"`). Currency-formatted strings (`"$385"`) fail with `400 DECIMAL_GTE`. The `normalizePrice` helper in the form template strips `$`/`,` and falls back to `"0"`.
|
|
32
|
-
|
|
33
|
-
4. **Visitor scope from the client; SSR-only elevation for the probe.**
|
|
34
|
-
- The form's subscribe call uses `@wix/ecom` straight from the React island — no `auth.elevate`, no Astro API route. The visitor token is enough.
|
|
35
|
-
- The settings probe uses `auth.elevate(httpClient.fetchWithAuth)` because `getSettings` requires Manage Stores. Run it in `[slug].astro` frontmatter, **never from the client**.
|
|
36
|
-
- Do NOT invent an Astro `src/pages/api/...` POST route. The `@wix/cloud-provider-fetch-adapter` that ships with the scaffold returned 403 to the browser on app-defined POST routes during the trial. Stay on the SDK.
|
|
37
|
-
|
|
38
|
-
5. **Module-memoize the probe.** `getBackInStockEnabled()` holds one in-flight `Promise<boolean>` at module scope so multiple SSR awaits in the same request coalesce. Same pattern as `gift-cards.ts`'s `getGiftCardProduct()`.
|
|
39
|
-
|
|
40
|
-
## Template files
|
|
41
|
-
|
|
42
|
-
This scope uses **template files** instead of inline code. For each file below:
|
|
43
|
-
|
|
44
|
-
1. Read the template from `<Agent location>/templates/<path>`
|
|
45
|
-
2. Write it to the project at the target path
|
|
46
|
-
3. Adapt CSS class names if the design tokens map them differently
|
|
47
|
-
|
|
48
|
-
Do NOT modify logic, imports, the bare-fields request shape, or the app-id constants.
|
|
49
|
-
|
|
50
|
-
### 1. `src/utils/back-in-stock.ts` — pre-copied, not owned by this scope
|
|
51
|
-
|
|
52
|
-
> Pre-copied by the orchestrator in the build-wave pre-batch (BUILD-astro.md § "Step 4.5") — same treatment as `categories.ts`. **Import** from `../utils/back-in-stock`; do NOT write it yourself. The exports below are documented here so callers (the form island, the `[slug].astro` probe) know the surface.
|
|
53
|
-
|
|
54
|
-
Exports:
|
|
55
|
-
- `WIX_STORES_BACK_IN_STOCK_APP_ID` — string constant. Use this for the `catalogReference.appId` in the form.
|
|
56
|
-
- `WIX_STORES_INSTALL_APP_ID` — string constant. Exported for completeness; unused by this file.
|
|
57
|
-
- `getBackInStockEnabled(): Promise<boolean>` — memoized SSR probe.
|
|
58
|
-
- `SETTINGS_URL` — the `getSettings` REST URL, exported in case future scopes need it.
|
|
59
|
-
|
|
60
|
-
The probe header comment block documents the app-id discrepancy in detail. Keep that block intact when copying — it's the only place the next maintainer will see the rationale.
|
|
61
|
-
|
|
62
|
-
### 2. `src/components/BackInStockForm.tsx`
|
|
63
|
-
|
|
64
|
-
Use template `templates/BackInStockForm.tsx`.
|
|
65
|
-
|
|
66
|
-
Props: `{ productId, variantId?, productName, productPrice: number | string, variantLabel? }`. The form accepts price as either a number or a numeric string and normalizes internally.
|
|
67
|
-
|
|
68
|
-
State machine: `idle → submitting → (success | error)` with `success` carrying an optional `alreadySubscribed` flag for the duplicate-detection branch (`BACK_IN_STOCK_NOTIFICATION_REQUEST_ALREADY_EXISTS` → "You're already on the list").
|
|
69
|
-
|
|
70
|
-
Class names:
|
|
71
|
-
- `.back-in-stock-form`, `.back-in-stock-headline`, `.back-in-stock-eyebrow`, `.back-in-stock-lede`, `.back-in-stock-label`, `.back-in-stock-row`, `.back-in-stock-input`, `.back-in-stock-submit`, `.back-in-stock-error`, `.back-in-stock-success`, `.back-in-stock-success-headline`, `.back-in-stock-success-detail` — defined in the CSS append below.
|
|
72
|
-
|
|
73
|
-
### 3. `src/styles/components-stores.css` — append
|
|
74
|
-
|
|
75
|
-
The `components-stores.css` template already covers options/quantity/modifiers/stock-status. Append the back-in-stock rules at the end. Use the existing pack token vocabulary (`bark`, `cream`, `parchment`, `ink`, `rule`) so the styling lands on every brand without per-site rewrites.
|
|
76
|
-
|
|
77
|
-
```css
|
|
78
|
-
/* --- Back-in-stock subscribe form (BackInStockForm.tsx) --- */
|
|
79
|
-
.back-in-stock-form {
|
|
80
|
-
@apply flex flex-col gap-4 mt-4 p-6 border border-rule rounded;
|
|
81
|
-
background-color: var(--color-cream);
|
|
82
|
-
}
|
|
83
|
-
.back-in-stock-headline {
|
|
84
|
-
@apply flex flex-col gap-3;
|
|
85
|
-
}
|
|
86
|
-
.back-in-stock-eyebrow {
|
|
87
|
-
@apply font-heading text-xs uppercase tracking-wider text-bark/70;
|
|
88
|
-
}
|
|
89
|
-
.back-in-stock-lede {
|
|
90
|
-
@apply font-body text-sm text-ink;
|
|
91
|
-
line-height: 1.5;
|
|
92
|
-
}
|
|
93
|
-
.back-in-stock-label {
|
|
94
|
-
@apply font-heading text-xs uppercase tracking-wider text-bark/70;
|
|
95
|
-
}
|
|
96
|
-
.back-in-stock-row {
|
|
97
|
-
@apply flex flex-row flex-wrap gap-3;
|
|
98
|
-
}
|
|
99
|
-
.back-in-stock-input {
|
|
100
|
-
@apply flex-1 px-4 py-3 font-body text-sm border border-rule rounded bg-parchment text-ink;
|
|
101
|
-
min-width: 0;
|
|
102
|
-
transition: border-color 0.15s ease;
|
|
103
|
-
}
|
|
104
|
-
.back-in-stock-input:focus {
|
|
105
|
-
@apply outline-none border-ink;
|
|
106
|
-
}
|
|
107
|
-
.back-in-stock-input[aria-invalid="true"] {
|
|
108
|
-
@apply border-rust;
|
|
109
|
-
}
|
|
110
|
-
.back-in-stock-submit {
|
|
111
|
-
@apply px-6 py-3 font-heading text-xs uppercase tracking-wider bg-bark text-cream rounded cursor-pointer transition-colors;
|
|
112
|
-
border: 1px solid var(--color-bark);
|
|
113
|
-
}
|
|
114
|
-
.back-in-stock-submit:hover:not(:disabled) {
|
|
115
|
-
@apply bg-ink;
|
|
116
|
-
}
|
|
117
|
-
.back-in-stock-submit:disabled {
|
|
118
|
-
@apply opacity-50 cursor-not-allowed;
|
|
119
|
-
}
|
|
120
|
-
.back-in-stock-error {
|
|
121
|
-
@apply font-body text-sm text-rust;
|
|
122
|
-
}
|
|
123
|
-
.back-in-stock-success {
|
|
124
|
-
@apply mt-4 p-6 border border-rule rounded;
|
|
125
|
-
background-color: var(--color-cream);
|
|
126
|
-
}
|
|
127
|
-
.back-in-stock-success-headline {
|
|
128
|
-
@apply font-heading text-base text-ink;
|
|
129
|
-
margin: 0 0 0.5rem 0;
|
|
130
|
-
}
|
|
131
|
-
.back-in-stock-success-detail {
|
|
132
|
-
@apply font-body text-sm text-ink;
|
|
133
|
-
line-height: 1.55;
|
|
134
|
-
margin: 0;
|
|
135
|
-
}
|
|
136
|
-
.stock-status.back-in-stock-alt {
|
|
137
|
-
@apply mt-3 font-body text-sm italic text-bark/70;
|
|
138
|
-
}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
If the brand's design tokens don't include a `rust` (error) color, fall back to a neutral `text-ink` on the error state — the `aria-invalid` border still flags it visually.
|
|
142
|
-
|
|
143
|
-
## Return format
|
|
144
|
-
|
|
145
|
-
The full components scope return must mention back-in-stock:
|
|
146
|
-
|
|
147
|
-
```json
|
|
148
|
-
{
|
|
149
|
-
"status": "complete",
|
|
150
|
-
"phase": "stores-components",
|
|
151
|
-
"scope": "components",
|
|
152
|
-
"summary": "Wrote stores islands, scoped CSS, back-in-stock probe + form",
|
|
153
|
-
"data": {
|
|
154
|
-
"islands": ["ProductPurchase.tsx", "AddToCartButton.tsx", "BackInStockForm.tsx"],
|
|
155
|
-
"scopedCssFile": "src/styles/components-stores.css",
|
|
156
|
-
"backInStockWired": true
|
|
157
|
-
},
|
|
158
|
-
"files": [
|
|
159
|
-
"src/components/SeoTags.astro",
|
|
160
|
-
"src/components/AddToCartButton.tsx",
|
|
161
|
-
"src/components/ProductPurchase.tsx",
|
|
162
|
-
"src/components/BackInStockForm.tsx",
|
|
163
|
-
"src/styles/components-stores.css"
|
|
164
|
-
],
|
|
165
|
-
"errors": []
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Anti-patterns
|
|
170
|
-
|
|
171
|
-
| WRONG | CORRECT |
|
|
172
|
-
|---|---|
|
|
173
|
-
| Use `215238eb-…` (Stores install id) as `catalogReference.appId` for back-in-stock | Use `WIX_STORES_BACK_IN_STOCK_APP_ID` (`1380b703-…`); the install id is rejected on V3 |
|
|
174
|
-
| Pass `itemUrl` or `image` to `createBackInStockNotificationRequest` | Send only `catalogReference`, `email`, `name`, numeric `price` — the SDK throws `Failed to construct 'URL': Invalid URL` on either optional field |
|
|
175
|
-
| Send `"$385"` as `price` | Numeric string `"385"` only; the API rejects formatted prices with `400 DECIMAL_GTE` |
|
|
176
|
-
| Wrap the subscribe call in `auth.elevate(...)` from the React island | Visitor scope is enough; elevation belongs only to the SSR probe |
|
|
177
|
-
| Add a custom `src/pages/api/back-in-stock-subscribe.ts` route | Not needed — SDK from the island works. The Wix cloud adapter returned 403 on app-defined POST routes during the trial. |
|
|
178
|
-
| Drop the module-memoization in `back-in-stock.ts` | Keep it; multiple SSR awaits in the same request coalesce into one `getSettings` call |
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# Phase 4 Category Pages — Stores
|
|
2
|
-
|
|
3
|
-
Scope: `pages-categories` — written by the stores **merged build agent** (the build wave) *before* its `pages-products` scope, so `<CategoryRail/>` is on disk before that scope mounts it. This scope writes the dedicated category landing route and the shared `<CategoryRail/>`. The `categories.ts` helper is **pre-copied by the orchestrator in the build-wave pre-batch** (BUILD-astro.md § "Step 4.5") — do NOT write it here.
|
|
4
|
-
|
|
5
|
-
**Within-agent order:** the merged stores agent writes `components` → `pages-categories` (this scope) → `pages-products`. `pages-home-and-nav` is a *separate* serialized agent (it patches the shared shells) and resolves `<CategoryRail/>` at build time (Step 8). Each scope only needs its own declared files to exist by the time `astro build` runs.
|
|
6
|
-
|
|
7
|
-
## Scope
|
|
8
|
-
|
|
9
|
-
Files this agent OWNS (writes):
|
|
10
|
-
|
|
11
|
-
- `src/pages/category/[slug].astro` — category landing (server-side filtered, cursor-paginated)
|
|
12
|
-
- `src/components/CategoryRail.astro` — shared rail + Prev/Next pagination, persisted across `<ClientRouter />` swaps
|
|
13
|
-
|
|
14
|
-
Files this agent imports but MUST NOT write:
|
|
15
|
-
- `src/utils/categories.ts` — TTL-cached helpers (`listStoreCategories`, `getCategoryBySlug`, `listProductsInCategory`). **Pre-copied by the orchestrator** before this phase (it's a static, brand-agnostic SDK wrapper); import the helpers, never author the file. Writing it races `pages-products`/`pages-home-and-nav`, which import the same path.
|
|
16
|
-
|
|
17
|
-
Files this agent MUST NOT touch:
|
|
18
|
-
- `src/pages/products/index.astro`, `[slug].astro`, `src/components/ProductCard.astro` — owned by `pages-products`
|
|
19
|
-
- `src/pages/index.astro`, `src/components/Navigation.astro` — owned by `pages-home-and-nav`
|
|
20
|
-
- `src/layouts/Layout.astro`, `global.css` — owned by designer (View Transitions + loading bar live there)
|
|
21
|
-
- `src/components/ProductPurchase.tsx`, `AddToCartButton.tsx`, `BackInStockForm.tsx` — owned by `components`
|
|
22
|
-
|
|
23
|
-
## Inputs (from parent prompt)
|
|
24
|
-
|
|
25
|
-
- **Phase 1 return data** — `categories: []`. Phase 1 does not seed categories (they're merchant-driven). This scope still writes the helper + rail + route — they're harmless when no categories exist, and they light up automatically once the merchant creates visible categories with items in the dashboard. `listStoreCategories()` queries the API live at SSR time (5-min TTL cache), so no redeploy is needed when categories are added later.
|
|
26
|
-
- **Design tokens** — read the design tokens (the DESIGN.md vocabulary) from `.wix/design-tokens.css` (on disk). Page header / breadcrumbs / pill / pagination styling should follow `references/shared/STYLING.md` (utilities derived from tokens, semantic classes only for primitives).
|
|
27
|
-
- **Designer output summary** — confirm `Layout.astro` already includes `<ClientRouter />`, `transition:persist` markers on nav/footer, and the `[data-nav-progress]` element + after-swap hook. If any of those is missing, return `status: "partial"` with `errors: [{ code: "DESIGNER_LAYOUT_MISSING_TRANSITIONS", path: "src/layouts/Layout.astro" }]`.
|
|
28
|
-
|
|
29
|
-
## Critical rules (all must be honored)
|
|
30
|
-
|
|
31
|
-
1. **Server-side filter only.** Do NOT ship a client-side filter that hides cards via `card.hidden = true` or `data-category-ids`. That pattern doesn't scale past a few hundred products and breaks SEO. Filtering is by URL: `/category/<slug>` is the canonical filter, server-renders only matching products. The rail click is a real navigation that `<ClientRouter />` swaps in place.
|
|
32
|
-
2. **Use `@wix/auto_sdk_categories_categories`**, not `@wix/categories` (the published name) — the auto_sdk package is already on disk via every other `@wix/*` package's transitive deps. Importing `@wix/categories` triggers a fresh `npm install`. The provided template uses `import * as categories from "@wix/auto_sdk_categories_categories"` already; do not rewrite.
|
|
33
|
-
3. **`queryCategories(...)` rejects empty filters.** The SDK builder's `.find()` validates that at least one predicate has been chained. Always include `.eq("visible", true)` (the constraint we want anyway). Provided template already does this.
|
|
34
|
-
4. **Filter out the auto-managed "All Products" category** by `handle === "online_stores_all_products"`. It's installed by Wix Stores automatically and contains every product; surfacing it in the rail makes the All pill duplicate.
|
|
35
|
-
5. **Filter out empty categories** by `itemCounter === 0` so the rail doesn't show buckets that 404 in practice (the route still works, but the pill leads to "Nothing in <name> just now").
|
|
36
|
-
6. **`STORES_APP_ID` lives in the pre-copied `categories.ts`** — the template already sets it to the Stores app id `215238eb-22a5-4c36-9e7b-e7c08025e04e` (same id used for cart ops and Phase 1 product seed; NOT the back-in-stock id `1380b703-…`). You do not write that file; this is documented so the helpers you import behave as expected.
|
|
37
|
-
7. **Cursor pagination** uses `productsV3.queryProducts().limit(24).skipTo(cursor)`. Cursor lives in `?cursor=…` on the URL, surfaced from `result.cursors.next` / `result.cursors.prev`. Prev/Next links use `data-astro-prefetch="hover"` so hovering them warms the cache.
|
|
38
|
-
8. **Module-level TTL cache (5 min)** in `categories.ts` is opportunistic; safe under the Cloudflare-style fetch adapter (each worker isolate is single-tenant). Errors don't poison the cache.
|
|
39
|
-
9. **Two-call pipeline** in `listProductsInCategory`: first `listItemsInCategory(categoryId, { appNamespace: "@wix/stores" })` for IDs, then `productsV3.queryProducts().in("_id", ids).limit(24).skipTo(cursor).find()`. There is no Wix endpoint that does category filter + cursor paging in one shot — don't attempt `listCategoriesForItems` from the SDK; it ships items via GET querystring and breaks on arrays. If you need product → categories mapping (e.g. for breadcrumbs on product detail), call the REST POST endpoint directly: `POST /categories/v1/categories/list-categories-for-items`.
|
|
40
|
-
|
|
41
|
-
## Writing the templates
|
|
42
|
-
|
|
43
|
-
Read each template at `references/astro/templates/stores/` and write it verbatim to the corresponding `src/` path, with three small adjustments. (`categories.ts` is **not** in this list — the orchestrator pre-copies it; you only import its helpers.)
|
|
44
|
-
|
|
45
|
-
| Template path | Site path |
|
|
46
|
-
|---|---|
|
|
47
|
-
| `templates/CategoryRail.astro` | `src/components/CategoryRail.astro` |
|
|
48
|
-
| `templates/category/[slug].astro` | `src/pages/category/[slug].astro` |
|
|
49
|
-
|
|
50
|
-
Adjustments at the call site:
|
|
51
|
-
|
|
52
|
-
1. The category page header copy ("Shop", breadcrumbs, lede) should adapt to brand tone. The template ships generic ("Browse our X collection"); rewrite the breadcrumb middle anchor and the empty-state line to match the rest of the site's voice. Keep semantics — same elements, same classes, same `data-*` markers.
|
|
53
|
-
2. If the brand uses an editorial eyebrow pattern on `/products` (e.g. "Issue No. 01 · The Collection"), mirror it on `/category/[slug]` (e.g. "Category · Lounge Chairs"). Otherwise omit.
|
|
54
|
-
3. Page-header CSS class names (`page-header`, `page-header-title`, `page-header-lede`, `breadcrumbs`, `page-header-image`) must match what the designer published. If the designer used different names, rename inside the template — do NOT introduce new ones.
|
|
55
|
-
|
|
56
|
-
## Pre-return file-existence assertion
|
|
57
|
-
|
|
58
|
-
Before returning `status: "complete"`, verify the two files you write exist:
|
|
59
|
-
|
|
60
|
-
- `src/components/CategoryRail.astro`
|
|
61
|
-
- `src/pages/category/[slug].astro`
|
|
62
|
-
|
|
63
|
-
If either is missing, return `status: "partial"` with `errors: [{ code: "PHASE4_FILE_MISSING", path: "<expected path>" }]`. The orchestrator's manifest check will also catch this, but an agent-side assertion gives a faster and more precise failure. Also confirm the pre-copied `src/utils/categories.ts` is on disk (you import it); if it's missing, that's an orchestrator-side bug — return `status: "partial"` with `errors: [{ code: "UTILITY_TEMPLATE_NOT_PRECOPIED", path: "src/utils/categories.ts" }]` and do NOT write your own.
|
|
64
|
-
|
|
65
|
-
## Return contract
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"status": "complete",
|
|
70
|
-
"phase": "stores-pages",
|
|
71
|
-
"scope": "pages-categories",
|
|
72
|
-
"summary": "Wrote shared CategoryRail + /category/[slug] route (imports the pre-copied categories helper); route renders M categories.",
|
|
73
|
-
"data": {
|
|
74
|
-
"categoriesRendered": 0,
|
|
75
|
-
"filesWritten": [
|
|
76
|
-
"src/components/CategoryRail.astro",
|
|
77
|
-
"src/pages/category/[slug].astro"
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
"files": [],
|
|
81
|
-
"errors": []
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Phase 1 always reports zero categories (it does not seed them). Set `categoriesRendered: 0` and return `status: "complete"` — the helper, rail, and route are still written so the storefront lights up automatically the first time the merchant creates a visible category with items in the dashboard, with no code change needed.
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# Phase 3 Components-CSS — Stores
|
|
2
|
-
|
|
3
|
-
**This stylesheet is pre-copied from the skill template by the orchestrator** (build-wave pre-batch, BUILD-astro.md § "Step 4.5") — there is no `components-css` subagent to dispatch. This file documents the CSS for reference so the stores `components` scope (in the merged build agent) knows the class-name surface it targets.
|
|
4
|
-
|
|
5
|
-
## What this scope owns
|
|
6
|
-
|
|
7
|
-
Exactly one file:
|
|
8
|
-
|
|
9
|
-
- `src/styles/components-stores.css` — scoped CSS for stores-specific contract keys (option pills, quantity stepper, stock status, modifier free-text input, product card, product grid, offer callout panel). Imported by `Layout.astro` (the designer foundation sets up the import).
|
|
10
|
-
|
|
11
|
-
## What this scope does NOT own
|
|
12
|
-
|
|
13
|
-
- Any `.tsx` or `.astro` file. Those are the `components` sibling scope (`./SHARED_WIRING.md`).
|
|
14
|
-
- `src/styles/global.css` — owned by the designer foundation. **You read it (to audit for stores-class leaks) but never write it.**
|
|
15
|
-
- `src/styles/components-ecom.css`, `src/styles/components-gift-cards.css` — owned by other packs' `components` (or `components-css`) scopes.
|
|
16
|
-
- `src/utils/back-in-stock.ts` — pre-copied by the orchestrator before this dispatch; not your concern.
|
|
17
|
-
|
|
18
|
-
## Reading set
|
|
19
|
-
|
|
20
|
-
You only need:
|
|
21
|
-
|
|
22
|
-
1. **`<SKILL_ROOT>/references/astro/templates/stores/components-stores.css`** — the canonical template. Read it once.
|
|
23
|
-
2. **`<SKILL_ROOT>/references/shared/STYLING.md`** — the styling-contract conventions (how to use `@apply`, the `@theme` token utilities, the no-default-Tailwind-colors rule, and the global-vs-scoped CSS ownership boundary).
|
|
24
|
-
3. **`<SKILL_ROOT>/references/shared/RETURN_CONTRACT.md`** — the return JSON shape.
|
|
25
|
-
4. **`src/styles/global.css`** in the project — read to audit for stores-class leaks (see § "Global-CSS leak audit" below).
|
|
26
|
-
5. **Design tokens (on disk)** — read the design tokens (the DESIGN.md vocabulary — `colors`/`typography`/`rounded`/`containers`; spacing is Tailwind's numeric scale, not a token) from `.wix/design-tokens.css` (gate-verified present before the wave). They are NOT inlined in your prompt.
|
|
27
|
-
|
|
28
|
-
You do NOT need to read `INSTRUCTIONS.md`, `SHARED_WIRING.md`, `BACK_IN_STOCK.md`, the TSX templates, the back-in-stock util, or any other reference. Skipping those reads is the point of the split — they would consume tokens for context this scope doesn't use.
|
|
29
|
-
|
|
30
|
-
## Implementation
|
|
31
|
-
|
|
32
|
-
### 1. Read the template
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
<SKILL_ROOT>/references/astro/templates/stores/components-stores.css
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
This is the canonical scoped CSS for the stores pack. Adapt sizing/spacing to the brand's aesthetic — use the design tokens from your prompt (`--color-bark`, `--color-cream`, `--radius-md`, `--font-display`, etc.); spacing uses Tailwind's numeric scale (`gap-4`, `py-24`), not a token. **Do not rename the class names or state modifiers** — they must match the contract keys the TSX components reference.
|
|
39
|
-
|
|
40
|
-
### 2. Use `@apply` with brand `@theme` utilities
|
|
41
|
-
|
|
42
|
-
The `@theme` block in `global.css` (written by the designer foundation) exposes the brand tokens as Tailwind utilities (e.g., `bg-bark`, `text-cream`, `font-body`). They are globally available because `global.css` is imported first in `Layout.astro`.
|
|
43
|
-
|
|
44
|
-
Use `@apply` for color, font, and spacing properties. Drop to `var(--color-bark)` directly when `@apply` doesn't cover a property (e.g., border-color via custom property).
|
|
45
|
-
|
|
46
|
-
Do **NOT** use default Tailwind colors (`bg-green-50`, `text-red-600`). The brand palette is the only allowed source.
|
|
47
|
-
|
|
48
|
-
### 3. Class ownership
|
|
49
|
-
|
|
50
|
-
Classes you own (define rules in `components-stores.css`):
|
|
51
|
-
|
|
52
|
-
- **`.product-card`, `.product-card-media`, `.product-card-ribbon`, `.product-card-index`** — the product card itself, including the `overflow: hidden` + `border-radius` clipping context. Whoever writes the `border-radius` here also writes any inner padding required to keep child content inside the rounded edges. Without inner padding, a price `<p>` sits flush against the rounded bottom corner and descenders get clipped. Add `padding-bottom: 1rem` on the card plus horizontal padding on each text block when you set the radius.
|
|
53
|
-
- **`.product-grid`** — the layout that lists product cards. Both `/products` (pages-products scope) and `/category/[slug]` (pages-categories scope) consume it from one place. Include `display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2rem;` plus the View-Transitions opacity fade for in-flight navigations.
|
|
54
|
-
- **`.offer-callout` family (`.offer-callout`, `-item`, `-badge`, `-name`, `-detail`, `-foot`)** — discount panel rendered above `<ProductPurchase>` on `/products/[slug]`.
|
|
55
|
-
- **Option-selector contract classes** — `option-group`, `option-label`, `option-choices`, `option-pill` (with `.selected` state modifier).
|
|
56
|
-
- **Quantity-stepper contract classes** — `quantity-selector`, `quantity-btn`, `quantity-value`.
|
|
57
|
-
- **Stock status** — `stock-status`.
|
|
58
|
-
- **Back-in-stock form** (`.back-in-stock-form` and child classes) — append the rules from `./BACK_IN_STOCK.md` § 3 to the end of `components-stores.css`. The TSX form island is written by the `components` sibling; this file owns its styling.
|
|
59
|
-
|
|
60
|
-
Classes you do NOT own:
|
|
61
|
-
|
|
62
|
-
- `.btn`, `.btn-primary`, `.btn-secondary` — designer's `global.css`.
|
|
63
|
-
- `addToCartButton` → `.add-to-cart-btn` — designer's `global.css` (it's a global contract key).
|
|
64
|
-
- `productPurchase` → `.product-purchase` outer wrapper — designer's `global.css`.
|
|
65
|
-
- Anything in `components-ecom.css` (CartBadge, CartView, CartLine) — owned by ecom pack.
|
|
66
|
-
|
|
67
|
-
The boundary: **rules referenced by exactly one pack's TSX live in that pack's scoped CSS; rules referenced by every page (buttons, links, type) live in the designer's `global.css`.**
|
|
68
|
-
|
|
69
|
-
### 4. Global-CSS leak audit
|
|
70
|
-
|
|
71
|
-
Before writing your file, **read `src/styles/global.css`** and grep for any class your scope owns. Stores-specific rules sometimes leak into the designer's foundation:
|
|
72
|
-
|
|
73
|
-
- `.product-grid` and `body[data-navigating="true"] .product-grid` — designer drift; should be in `components-stores.css`, not `global.css`.
|
|
74
|
-
- Any `.product-card-*` rule.
|
|
75
|
-
- Any `.offer-callout-*` rule.
|
|
76
|
-
- Any contract class that maps to a key in `contractKeys.scoped.stores`.
|
|
77
|
-
|
|
78
|
-
If you find a leak, do NOT edit `global.css` (the designer owns it). Instead:
|
|
79
|
-
|
|
80
|
-
1. Override the rule with the complete declaration in `components-stores.css` (later imports win in CSS cascade because Layout.astro imports `components-stores.css` AFTER `global.css`).
|
|
81
|
-
2. Add `{code: "GLOBAL_CSS_LEAK", class: "<name>", file: "src/styles/global.css"}` to your return JSON's `errors` array — non-fatal but tracked.
|
|
82
|
-
|
|
83
|
-
### 5. Write the file
|
|
84
|
-
|
|
85
|
-
Write the adapted CSS to `src/styles/components-stores.css`. The first line must be `@reference "./global.css";` so Tailwind's `@apply` resolves the `@theme` utilities. The orchestrator's post-Phase-3 manifest check verifies the file exists; it does not verify the `@reference` line.
|
|
86
|
-
|
|
87
|
-
## Coordination: design tokens
|
|
88
|
-
|
|
89
|
-
Read the design tokens from `.wix/design-tokens.css` (on disk, gate-verified present before the wave) — they are NOT inlined in your prompt.
|
|
90
|
-
|
|
91
|
-
## Return format
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
{
|
|
95
|
-
"status": "complete",
|
|
96
|
-
"phase": "stores-components-css",
|
|
97
|
-
"scope": "components-css",
|
|
98
|
-
"summary": "Wrote components-stores.css from template, adapted to brand tokens",
|
|
99
|
-
"data": {
|
|
100
|
-
"scopedCssFile": "src/styles/components-stores.css",
|
|
101
|
-
"scopedCssRules": 18,
|
|
102
|
-
"scopedContractClassesDefined": [
|
|
103
|
-
"option-group", "option-label", "option-choices", "option-pill",
|
|
104
|
-
"quantity-selector", "quantity-btn", "quantity-value",
|
|
105
|
-
"stock-status",
|
|
106
|
-
"product-card", "product-card-media", "product-card-ribbon", "product-card-index",
|
|
107
|
-
"product-grid",
|
|
108
|
-
"offer-callout", "offer-callout-item", "offer-callout-badge", "offer-callout-name", "offer-callout-detail", "offer-callout-foot"
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
"files": [
|
|
112
|
-
"src/styles/components-stores.css"
|
|
113
|
-
],
|
|
114
|
-
"errors": []
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
If a leak was found and overridden, include `errors: [{code: "GLOBAL_CSS_LEAK", class: "<name>", file: "src/styles/global.css"}]`.
|
|
119
|
-
|
|
120
|
-
## Anti-patterns
|
|
121
|
-
|
|
122
|
-
| WRONG | CORRECT |
|
|
123
|
-
|-------|---------|
|
|
124
|
-
| Read `INSTRUCTIONS.md`, `SHARED_WIRING.md`, or any `.tsx` template | Not needed — this scope only writes CSS |
|
|
125
|
-
| Edit `src/styles/global.css` to fix a leak | Override in `components-stores.css`; report the leak in `errors` |
|
|
126
|
-
| Use default Tailwind colors (`bg-green-50`, `text-red-600`) | Brand `@theme` utilities (`bg-bark`, `text-cream`) or `var(--color-...)` |
|
|
127
|
-
| Write rules for `.add-to-cart-btn` here | That's a global contract class — owned by the designer's `global.css` |
|
|
128
|
-
| Rename a class because the brand is "more elegant" with kebab-cased variants | Class names are contract keys; renaming breaks every TSX import that references them |
|
|
129
|
-
| Skip the leak audit | Skipping ships double-defined rules; the audit is < 5 s and prevents downstream visual regressions |
|