@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,302 +0,0 @@
|
|
|
1
|
-
/* src/styles/components-ecom.css
|
|
2
|
-
*
|
|
3
|
-
* Ecom-pack component CSS. Owned by the ecom Phase 3 components agent.
|
|
4
|
-
*
|
|
5
|
-
* This file is the SINGLE source of truth for ecom-component classes.
|
|
6
|
-
* The designer's global.css does NOT publish .cart-summary, .cart-total,
|
|
7
|
-
* .cart-empty, or .checkout-btn — those all live here. See
|
|
8
|
-
* references/shared/STYLING.md § "Component-specific CSS is owned by the
|
|
9
|
-
* component, not the designer".
|
|
10
|
-
*
|
|
11
|
-
* Class groups in this file:
|
|
12
|
-
* - .cart-summary / .cart-total / .cart-empty / .checkout-btn → /cart page summary panel and empty state
|
|
13
|
-
* - .cart-item / .cart-item-* / .qty-* → CartView.tsx line items
|
|
14
|
-
* - .cart-discount / .cart-applied-discounts → CartView.tsx discount rows
|
|
15
|
-
* - .cart-badge / .cart-badge-* → CartBadge.tsx (mounted in Navigation)
|
|
16
|
-
*
|
|
17
|
-
* Rules use direct CSS (`var(--token)`) only — no `@apply`. Tailwind v4
|
|
18
|
-
* `@apply` in a non-entrypoint file only resolves utilities whose theme keys
|
|
19
|
-
* the designer's `@theme` block declares. Earlier revisions of this template
|
|
20
|
-
* used `@apply text-bark/70 bg-tobacco …` (stale token vocabulary) and
|
|
21
|
-
* `@apply size-6` (built-in utility that needs `@reference` to be visible
|
|
22
|
-
* here), and both classes built-failed against current designer output.
|
|
23
|
-
* Direct `var(--color-ink)` / `0.75rem` calls work against any
|
|
24
|
-
* designer-published token set as long as the core scales exist (they always
|
|
25
|
-
* do). Use fallback chains (`var(--color-paper-warm, var(--color-paper, var(--color-cream)))`)
|
|
26
|
-
* for sometimes-published tokens.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/* =========================================================================
|
|
30
|
-
Cart summary panel + total + checkout button + empty state.
|
|
31
|
-
Owned here, NOT in global.css.
|
|
32
|
-
========================================================================= */
|
|
33
|
-
.cart-summary {
|
|
34
|
-
background: var(--color-paper-warm, var(--color-paper, var(--color-cream)));
|
|
35
|
-
border: 1px solid var(--color-rule);
|
|
36
|
-
padding: 2rem;
|
|
37
|
-
border-radius: var(--radius-md);
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
gap: 0.75rem;
|
|
41
|
-
}
|
|
42
|
-
@media (min-width: 768px) {
|
|
43
|
-
.cart-summary {
|
|
44
|
-
position: sticky;
|
|
45
|
-
top: 2rem;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.cart-empty {
|
|
50
|
-
text-align: center;
|
|
51
|
-
padding-block: 4rem;
|
|
52
|
-
color: var(--color-mute);
|
|
53
|
-
}
|
|
54
|
-
.cart-empty .checkout-btn {
|
|
55
|
-
display: inline-flex;
|
|
56
|
-
width: auto;
|
|
57
|
-
max-width: 18rem;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* .checkout-btn — primary CTA, full-width inside .cart-summary. Self-contained;
|
|
61
|
-
does NOT @apply the designer's `btn` utility (Tailwind v4 only @applies
|
|
62
|
-
utilities declared with `@utility`, and the designer may or may not have
|
|
63
|
-
declared it under that exact name). Composing the same visual shape inline
|
|
64
|
-
keeps this file portable across designer vocabularies. */
|
|
65
|
-
.checkout-btn {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
padding: 1rem 1.5rem;
|
|
70
|
-
font-family: var(--font-display);
|
|
71
|
-
font-size: 0.9375rem;
|
|
72
|
-
font-weight: 500;
|
|
73
|
-
background: var(--color-ink);
|
|
74
|
-
color: var(--color-paper);
|
|
75
|
-
border: 1px solid var(--color-ink);
|
|
76
|
-
border-radius: var(--radius-sm);
|
|
77
|
-
cursor: pointer;
|
|
78
|
-
width: 100%;
|
|
79
|
-
margin-top: 1rem;
|
|
80
|
-
transition: background-color 150ms ease, box-shadow 150ms ease;
|
|
81
|
-
}
|
|
82
|
-
.checkout-btn:hover:not(:disabled) {
|
|
83
|
-
background: var(--color-ink-soft, var(--color-ink));
|
|
84
|
-
}
|
|
85
|
-
.checkout-btn:disabled {
|
|
86
|
-
opacity: 0.5;
|
|
87
|
-
cursor: not-allowed;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/* --- Cart badge icon (CartBadge.tsx) --- */
|
|
91
|
-
/* CartBadge.tsx renders an inline SVG bag icon + optional count span. */
|
|
92
|
-
.cart-badge {
|
|
93
|
-
position: relative;
|
|
94
|
-
display: inline-flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
justify-content: center;
|
|
97
|
-
}
|
|
98
|
-
.cart-badge-icon {
|
|
99
|
-
width: 1.5rem;
|
|
100
|
-
height: 1.5rem;
|
|
101
|
-
flex-shrink: 0;
|
|
102
|
-
}
|
|
103
|
-
.cart-badge-count {
|
|
104
|
-
position: absolute;
|
|
105
|
-
top: -0.25rem;
|
|
106
|
-
right: -0.5rem;
|
|
107
|
-
min-width: 1.25rem;
|
|
108
|
-
height: 1.25rem;
|
|
109
|
-
padding: 0 0.25rem;
|
|
110
|
-
display: inline-flex;
|
|
111
|
-
align-items: center;
|
|
112
|
-
justify-content: center;
|
|
113
|
-
border-radius: 9999px;
|
|
114
|
-
background: var(--color-ink);
|
|
115
|
-
color: var(--color-paper);
|
|
116
|
-
font-family: var(--font-body);
|
|
117
|
-
font-size: 0.75rem;
|
|
118
|
-
font-variant-numeric: tabular-nums;
|
|
119
|
-
line-height: 1;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/* --- Cart line items (CartView.tsx) --- */
|
|
123
|
-
.cart-item {
|
|
124
|
-
display: flex;
|
|
125
|
-
flex-direction: row;
|
|
126
|
-
gap: 1rem;
|
|
127
|
-
}
|
|
128
|
-
.cart-item-image {
|
|
129
|
-
flex-shrink: 0;
|
|
130
|
-
}
|
|
131
|
-
.cart-item-image-link {
|
|
132
|
-
display: block;
|
|
133
|
-
flex-shrink: 0;
|
|
134
|
-
cursor: pointer;
|
|
135
|
-
}
|
|
136
|
-
.cart-item-image-link:hover .cart-item-image,
|
|
137
|
-
.cart-item-image-link:focus-visible .cart-item-image {
|
|
138
|
-
border-color: var(--color-ink);
|
|
139
|
-
}
|
|
140
|
-
.cart-item-name-link {
|
|
141
|
-
color: inherit;
|
|
142
|
-
cursor: pointer;
|
|
143
|
-
text-decoration: none;
|
|
144
|
-
border-bottom: 1px solid var(--color-mute);
|
|
145
|
-
padding-bottom: 1px;
|
|
146
|
-
transition: color 150ms ease, border-color 150ms ease;
|
|
147
|
-
}
|
|
148
|
-
.cart-item-name-link:hover,
|
|
149
|
-
.cart-item-name-link:focus-visible {
|
|
150
|
-
color: var(--color-accent);
|
|
151
|
-
outline: none;
|
|
152
|
-
border-bottom-color: var(--color-accent);
|
|
153
|
-
}
|
|
154
|
-
.cart-item-info {
|
|
155
|
-
flex: 1;
|
|
156
|
-
min-width: 0;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* --- Description lines & modifiers --- */
|
|
160
|
-
.cart-item-option {
|
|
161
|
-
font-family: var(--font-body);
|
|
162
|
-
font-size: 0.875rem;
|
|
163
|
-
color: var(--color-ink-soft, var(--color-mute));
|
|
164
|
-
margin: 0.125rem 0;
|
|
165
|
-
}
|
|
166
|
-
.cart-item-modifiers {
|
|
167
|
-
margin-top: 0.25rem;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/* --- Quantity stepper --- */
|
|
171
|
-
.cart-item-qty {
|
|
172
|
-
display: inline-flex;
|
|
173
|
-
align-items: center;
|
|
174
|
-
gap: 0.75rem;
|
|
175
|
-
margin-top: 0.75rem;
|
|
176
|
-
width: fit-content;
|
|
177
|
-
}
|
|
178
|
-
.qty-btn {
|
|
179
|
-
width: 1.75rem;
|
|
180
|
-
height: 1.75rem;
|
|
181
|
-
display: inline-flex;
|
|
182
|
-
align-items: center;
|
|
183
|
-
justify-content: center;
|
|
184
|
-
border: 1px solid var(--color-ink);
|
|
185
|
-
border-radius: var(--radius-sm);
|
|
186
|
-
background: transparent;
|
|
187
|
-
color: var(--color-ink);
|
|
188
|
-
cursor: pointer;
|
|
189
|
-
font-family: var(--font-body);
|
|
190
|
-
font-size: 1rem;
|
|
191
|
-
line-height: 1;
|
|
192
|
-
}
|
|
193
|
-
.qty-btn:disabled {
|
|
194
|
-
opacity: 0.3;
|
|
195
|
-
cursor: not-allowed;
|
|
196
|
-
}
|
|
197
|
-
.qty-value {
|
|
198
|
-
font-family: var(--font-body);
|
|
199
|
-
font-size: 0.875rem;
|
|
200
|
-
min-width: 1.5rem;
|
|
201
|
-
text-align: center;
|
|
202
|
-
font-variant-numeric: tabular-nums;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/* --- Unavailable state --- */
|
|
206
|
-
.cart-item-unavailable {
|
|
207
|
-
font-family: var(--font-body);
|
|
208
|
-
font-size: 0.875rem;
|
|
209
|
-
font-weight: 500;
|
|
210
|
-
color: var(--color-error, #c0392b);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/* --- Price + remove --- */
|
|
214
|
-
.cart-item-actions {
|
|
215
|
-
display: flex;
|
|
216
|
-
flex-direction: column;
|
|
217
|
-
align-items: flex-end;
|
|
218
|
-
gap: 0.25rem;
|
|
219
|
-
flex-shrink: 0;
|
|
220
|
-
}
|
|
221
|
-
.cart-item-prices {
|
|
222
|
-
display: flex;
|
|
223
|
-
align-items: center;
|
|
224
|
-
gap: 0.75rem;
|
|
225
|
-
}
|
|
226
|
-
.cart-item-full-price {
|
|
227
|
-
font-family: var(--font-body);
|
|
228
|
-
font-size: 0.875rem;
|
|
229
|
-
color: var(--color-ink-soft, var(--color-mute));
|
|
230
|
-
text-decoration: line-through;
|
|
231
|
-
}
|
|
232
|
-
.cart-item-unit-price {
|
|
233
|
-
font-family: var(--font-body);
|
|
234
|
-
font-weight: 600;
|
|
235
|
-
white-space: nowrap;
|
|
236
|
-
}
|
|
237
|
-
.cart-item-line-total {
|
|
238
|
-
font-family: var(--font-body);
|
|
239
|
-
font-size: 0.75rem;
|
|
240
|
-
color: var(--color-ink-soft, var(--color-mute));
|
|
241
|
-
margin: 0;
|
|
242
|
-
}
|
|
243
|
-
.cart-item-remove {
|
|
244
|
-
background: transparent;
|
|
245
|
-
border: none;
|
|
246
|
-
font-family: var(--font-body);
|
|
247
|
-
font-size: 0.875rem;
|
|
248
|
-
color: var(--color-mute);
|
|
249
|
-
cursor: pointer;
|
|
250
|
-
text-decoration: underline;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/* --- Cart summary: discount + total rows ---
|
|
254
|
-
Subtotal uses the designer's .cart-subtotal contract class in global.css.
|
|
255
|
-
These rows appear only when priceSummary exposes a discount or a total
|
|
256
|
-
that differs from subtotal (see CartView.tsx extractSummary). */
|
|
257
|
-
.cart-discount {
|
|
258
|
-
display: flex;
|
|
259
|
-
align-items: baseline;
|
|
260
|
-
justify-content: space-between;
|
|
261
|
-
gap: 0.75rem;
|
|
262
|
-
font-family: var(--font-body);
|
|
263
|
-
font-size: 0.875rem;
|
|
264
|
-
margin-top: 0.75rem;
|
|
265
|
-
}
|
|
266
|
-
.cart-discount-name {
|
|
267
|
-
font-size: 0.75rem;
|
|
268
|
-
color: var(--color-ink-soft, var(--color-mute));
|
|
269
|
-
}
|
|
270
|
-
.cart-discount-amount {
|
|
271
|
-
white-space: nowrap;
|
|
272
|
-
}
|
|
273
|
-
.cart-total {
|
|
274
|
-
border-top: 1px solid var(--color-rule);
|
|
275
|
-
padding-top: 1rem;
|
|
276
|
-
margin-top: 0.75rem;
|
|
277
|
-
font-family: var(--font-display);
|
|
278
|
-
font-size: 1.25rem;
|
|
279
|
-
font-weight: 500;
|
|
280
|
-
display: flex;
|
|
281
|
-
justify-content: space-between;
|
|
282
|
-
align-items: baseline;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/* Applied-discounts row — name-only (no amount) for cases where the API
|
|
286
|
-
reports a promo NAME via appliedDiscounts[].discountName but no cart-level
|
|
287
|
-
amount in priceSummary.discount (common for line-item automatic discounts
|
|
288
|
-
— the savings already show inline via fullPrice/price strikethrough). */
|
|
289
|
-
.cart-applied-discounts {
|
|
290
|
-
display: flex;
|
|
291
|
-
align-items: baseline;
|
|
292
|
-
justify-content: space-between;
|
|
293
|
-
gap: 0.75rem;
|
|
294
|
-
font-family: var(--font-body);
|
|
295
|
-
font-size: 0.875rem;
|
|
296
|
-
margin-top: 0.75rem;
|
|
297
|
-
}
|
|
298
|
-
.cart-applied-discounts-name {
|
|
299
|
-
text-align: right;
|
|
300
|
-
color: var(--color-ink-soft, var(--color-mute));
|
|
301
|
-
font-style: italic;
|
|
302
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// Live discount-rule fetch + per-product matching for storefront indicators.
|
|
2
|
-
// Owned by the ecom pack because Wix Discount Rules is an @wix/ecom primitive.
|
|
3
|
-
// Consumers: stores pack (ProductCard ribbon, product-detail offer callout,
|
|
4
|
-
// home featured grid). Future ecom-using verticals (bookings, events) can
|
|
5
|
-
// reuse the same util without change.
|
|
6
|
-
//
|
|
7
|
-
// Gotchas encoded here — do not remove:
|
|
8
|
-
// 1. queryDiscountRules needs ECOM.DISCOUNT_RULES_READ — must be called via
|
|
9
|
-
// auth.elevate(), otherwise a visitor client returns no rules silently.
|
|
10
|
-
// 2. Scope objects are returned with `_id` (underscore), not `id`. Check both.
|
|
11
|
-
// 3. "All products" scope shape: { _id: "all_<appDefId>", catalogItemFilter:
|
|
12
|
-
// { catalogAppId, catalogItemIds: [] } }. Empty array + app id = applies
|
|
13
|
-
// to every product.
|
|
14
|
-
|
|
15
|
-
import { discountRules } from "@wix/ecom";
|
|
16
|
-
import { auth } from "@wix/essentials";
|
|
17
|
-
|
|
18
|
-
export interface DiscountOffer {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
offer: string;
|
|
22
|
-
targetType: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function applies(scopes: any[] | undefined, productId: string): boolean {
|
|
26
|
-
if (!scopes || scopes.length === 0) return false;
|
|
27
|
-
for (const s of scopes) {
|
|
28
|
-
const scopeId = s?._id ?? s?.id;
|
|
29
|
-
if (typeof scopeId === "string" && scopeId.startsWith("all_")) return true;
|
|
30
|
-
const ids = s?.catalogItemFilter?.catalogItemIds;
|
|
31
|
-
if (Array.isArray(ids) && ids.length === 0 && s?.catalogItemFilter?.catalogAppId) return true;
|
|
32
|
-
if (Array.isArray(ids) && ids.includes(productId)) return true;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function ruleApplies(rule: any, productId: string): boolean {
|
|
38
|
-
const values = rule?.discounts?.values ?? [];
|
|
39
|
-
for (const v of values) {
|
|
40
|
-
if (v?.targetType === "SPECIFIC_ITEMS") {
|
|
41
|
-
if (applies(v?.specificItemsInfo?.scopes, productId)) return true;
|
|
42
|
-
} else if (v?.targetType === "BUY_X_GET_Y") {
|
|
43
|
-
if (applies(v?.buyXGetYInfo?.customerBuys?.scopes, productId)) return true;
|
|
44
|
-
if (applies(v?.buyXGetYInfo?.customerGets?.scopes, productId)) return true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export async function fetchLiveOffers(): Promise<any[]> {
|
|
51
|
-
try {
|
|
52
|
-
const elevated = auth.elevate(discountRules.queryDiscountRules);
|
|
53
|
-
const res: any = await elevated({ paging: { limit: 50 } } as any);
|
|
54
|
-
const list = res?.discountRules ?? res?.items ?? [];
|
|
55
|
-
return list.filter((r: any) => r?.active !== false && r?.status !== "EXPIRED");
|
|
56
|
-
} catch (err) {
|
|
57
|
-
console.error("[discounts] queryDiscountRules failed:", err);
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function offersForProduct(rules: any[], productId: string): DiscountOffer[] {
|
|
63
|
-
return rules
|
|
64
|
-
.filter((r) => ruleApplies(r, productId))
|
|
65
|
-
.map((r) => ({
|
|
66
|
-
id: r._id ?? r.id,
|
|
67
|
-
name: r.name ?? "",
|
|
68
|
-
offer: (r.offer ?? r.name ?? "").toString(),
|
|
69
|
-
targetType: r?.discounts?.values?.[0]?.targetType ?? "",
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import Layout from "../layouts/Layout.astro";
|
|
3
|
-
|
|
4
|
-
const orderId = Astro.url.searchParams.get("orderId");
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<Layout title="Thank You">
|
|
8
|
-
<main class="py-24">
|
|
9
|
-
<div class="max-w-prose mx-auto px-8 text-center flex flex-col gap-6">
|
|
10
|
-
<h1 class="font-display text-5xl">Thank You!</h1>
|
|
11
|
-
<p class="text-ink-soft">Your order has been placed successfully.</p>
|
|
12
|
-
{orderId && <p class="text-mute text-sm tracking-wide">Order ID: {orderId}</p>}
|
|
13
|
-
<a href="/products" class="btn-primary self-center mt-4">Continue Shopping</a>
|
|
14
|
-
</div>
|
|
15
|
-
</main>
|
|
16
|
-
</Layout>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
import { trackEvent } from "../utils/analytics";
|
|
20
|
-
const orderId = new URLSearchParams(window.location.search).get("orderId");
|
|
21
|
-
if (orderId) {
|
|
22
|
-
trackEvent("Purchase", { id: orderId, origin: "Thank You Page" });
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { currentCart } from "@wix/ecom";
|
|
3
|
-
import { trackEvent } from "../utils/analytics";
|
|
4
|
-
import {
|
|
5
|
-
WIX_GIFT_CARDS_APP_ID,
|
|
6
|
-
type GiftCardProduct,
|
|
7
|
-
type GiftCardPresetVariant,
|
|
8
|
-
} from "../utils/gift-cards";
|
|
9
|
-
|
|
10
|
-
interface GiftCardPurchaseProps {
|
|
11
|
-
product: GiftCardProduct;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// catalogReference shape captured from a real paid Wix-Editor order:
|
|
15
|
-
// { appId: WIX_GIFT_CARDS_APP_ID,
|
|
16
|
-
// catalogItemId: <giftCardProduct.id>,
|
|
17
|
-
// options: { variantId, quantity, currency, giftingInfo, wixGiftCardsAppNewCatalog: true } }
|
|
18
|
-
// On ORDER_PAID, Wix's gift-card backend auto-issues a redeemable card with
|
|
19
|
-
// source: "ORDER" and emails the recipient — no follow-up API call needed.
|
|
20
|
-
export default function GiftCardPurchase({ product }: GiftCardPurchaseProps) {
|
|
21
|
-
const [variantId, setVariantId] = useState<string>(product.presetVariants[0]?.id ?? "");
|
|
22
|
-
const [recipientFirstName, setRecipientFirstName] = useState("");
|
|
23
|
-
const [recipientLastName, setRecipientLastName] = useState("");
|
|
24
|
-
const [recipientEmail, setRecipientEmail] = useState("");
|
|
25
|
-
const [greetingMessage, setGreetingMessage] = useState("");
|
|
26
|
-
const [status, setStatus] = useState<"idle" | "adding" | "added" | "error">("idle");
|
|
27
|
-
const [error, setError] = useState<string | null>(null);
|
|
28
|
-
|
|
29
|
-
const selectedVariant: GiftCardPresetVariant | undefined =
|
|
30
|
-
product.presetVariants.find((v) => v.id === variantId);
|
|
31
|
-
|
|
32
|
-
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(recipientEmail);
|
|
33
|
-
const canSubmit =
|
|
34
|
-
!!selectedVariant &&
|
|
35
|
-
recipientFirstName.trim().length > 0 &&
|
|
36
|
-
emailValid &&
|
|
37
|
-
status !== "adding";
|
|
38
|
-
|
|
39
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
if (!canSubmit || !selectedVariant) return;
|
|
42
|
-
setStatus("adding");
|
|
43
|
-
setError(null);
|
|
44
|
-
try {
|
|
45
|
-
const { cart } = await currentCart.addToCurrentCart({
|
|
46
|
-
lineItems: [
|
|
47
|
-
{
|
|
48
|
-
catalogReference: {
|
|
49
|
-
appId: WIX_GIFT_CARDS_APP_ID,
|
|
50
|
-
catalogItemId: product.id,
|
|
51
|
-
options: {
|
|
52
|
-
variantId: selectedVariant.id,
|
|
53
|
-
quantity: 1,
|
|
54
|
-
giftingInfo: {
|
|
55
|
-
recipientInfo: {
|
|
56
|
-
email: recipientEmail.trim(),
|
|
57
|
-
firstName: recipientFirstName.trim(),
|
|
58
|
-
lastName: recipientLastName.trim(),
|
|
59
|
-
},
|
|
60
|
-
greetingMessage: greetingMessage.trim(),
|
|
61
|
-
},
|
|
62
|
-
wixGiftCardsAppNewCatalog: true,
|
|
63
|
-
} as Record<string, unknown>,
|
|
64
|
-
},
|
|
65
|
-
quantity: 1,
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
});
|
|
69
|
-
window.dispatchEvent(new CustomEvent("cart-updated", { detail: { cart, delta: 1 } }));
|
|
70
|
-
trackEvent("AddToCart", {
|
|
71
|
-
id: product.id,
|
|
72
|
-
name: product.name,
|
|
73
|
-
price: Number(selectedVariant.price.amount),
|
|
74
|
-
quantity: 1,
|
|
75
|
-
variant: selectedVariant.price.formattedAmount,
|
|
76
|
-
origin: "Gift Card Page",
|
|
77
|
-
});
|
|
78
|
-
setStatus("added");
|
|
79
|
-
window.location.href = "/cart";
|
|
80
|
-
} catch (err: any) {
|
|
81
|
-
console.error("[gift-cards] addToCurrentCart failed:", err);
|
|
82
|
-
setError(err?.message ?? "Could not add the gift card to your cart. Please try again.");
|
|
83
|
-
setStatus("error");
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<form className="gift-card-form" onSubmit={handleSubmit} noValidate>
|
|
89
|
-
<fieldset className="gift-card-fieldset">
|
|
90
|
-
<legend className="option-label">Amount</legend>
|
|
91
|
-
<div className="gift-card-amounts">
|
|
92
|
-
{product.presetVariants.map((v) => {
|
|
93
|
-
const sel = v.id === variantId;
|
|
94
|
-
return (
|
|
95
|
-
<button
|
|
96
|
-
key={v.id}
|
|
97
|
-
type="button"
|
|
98
|
-
onClick={() => setVariantId(v.id)}
|
|
99
|
-
className={`option-pill${sel ? " selected" : ""}`}
|
|
100
|
-
aria-pressed={sel}
|
|
101
|
-
>
|
|
102
|
-
{v.price.formattedAmount}
|
|
103
|
-
</button>
|
|
104
|
-
);
|
|
105
|
-
})}
|
|
106
|
-
</div>
|
|
107
|
-
</fieldset>
|
|
108
|
-
|
|
109
|
-
<div className="gift-card-grid">
|
|
110
|
-
<label className="gift-card-field">
|
|
111
|
-
<span className="option-label">Recipient first name *</span>
|
|
112
|
-
<input
|
|
113
|
-
type="text"
|
|
114
|
-
value={recipientFirstName}
|
|
115
|
-
onChange={(e) => setRecipientFirstName(e.target.value)}
|
|
116
|
-
required
|
|
117
|
-
autoComplete="off"
|
|
118
|
-
/>
|
|
119
|
-
</label>
|
|
120
|
-
|
|
121
|
-
<label className="gift-card-field">
|
|
122
|
-
<span className="option-label">Recipient last name</span>
|
|
123
|
-
<input
|
|
124
|
-
type="text"
|
|
125
|
-
value={recipientLastName}
|
|
126
|
-
onChange={(e) => setRecipientLastName(e.target.value)}
|
|
127
|
-
autoComplete="off"
|
|
128
|
-
/>
|
|
129
|
-
</label>
|
|
130
|
-
|
|
131
|
-
<label className="gift-card-field gift-card-field-wide">
|
|
132
|
-
<span className="option-label">Recipient email *</span>
|
|
133
|
-
<input
|
|
134
|
-
type="email"
|
|
135
|
-
value={recipientEmail}
|
|
136
|
-
onChange={(e) => setRecipientEmail(e.target.value)}
|
|
137
|
-
required
|
|
138
|
-
autoComplete="off"
|
|
139
|
-
/>
|
|
140
|
-
</label>
|
|
141
|
-
|
|
142
|
-
<label className="gift-card-field gift-card-field-wide">
|
|
143
|
-
<span className="option-label">Personal message</span>
|
|
144
|
-
<textarea
|
|
145
|
-
value={greetingMessage}
|
|
146
|
-
onChange={(e) => setGreetingMessage(e.target.value.slice(0, 500))}
|
|
147
|
-
maxLength={500}
|
|
148
|
-
rows={3}
|
|
149
|
-
placeholder="A short note to the recipient…"
|
|
150
|
-
/>
|
|
151
|
-
<span className="gift-card-counter">{greetingMessage.length} / 500</span>
|
|
152
|
-
</label>
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
{error && <p className="gift-card-error" role="alert">{error}</p>}
|
|
156
|
-
|
|
157
|
-
<button
|
|
158
|
-
type="submit"
|
|
159
|
-
disabled={!canSubmit}
|
|
160
|
-
className="add-to-cart-btn"
|
|
161
|
-
>
|
|
162
|
-
{status === "adding"
|
|
163
|
-
? "Adding…"
|
|
164
|
-
: status === "added"
|
|
165
|
-
? "Added ✓"
|
|
166
|
-
: selectedVariant
|
|
167
|
-
? `Add ${selectedVariant.price.formattedAmount} gift card to cart`
|
|
168
|
-
: "Add to cart"}
|
|
169
|
-
</button>
|
|
170
|
-
</form>
|
|
171
|
-
);
|
|
172
|
-
}
|
package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{/*
|
|
2
|
-
index.astro contribution. Insert the block below immediately AFTER the
|
|
3
|
-
`<!-- home:gift-cards -->` marker. ALSO add to the file's frontmatter
|
|
4
|
-
(above the `---` close):
|
|
5
|
-
|
|
6
|
-
import { getGiftCardProduct } from "../utils/gift-cards";
|
|
7
|
-
import { resolveWixImageUrl } from "../utils/wix-image";
|
|
8
|
-
|
|
9
|
-
const giftCardProduct = await getGiftCardProduct();
|
|
10
|
-
const giftCardImage = giftCardProduct
|
|
11
|
-
? resolveWixImageUrl(giftCardProduct.image, 800, 600)
|
|
12
|
-
: null;
|
|
13
|
-
|
|
14
|
-
If `resolveWixImageUrl` is already imported by the stores patcher, do not
|
|
15
|
-
re-import — Astro frontmatter is TypeScript and duplicate imports build-fail.
|
|
16
|
-
|
|
17
|
-
The "A gift, considered" eyebrow can be replaced with brand-appropriate copy
|
|
18
|
-
during adaptation; keep the structure as-is.
|
|
19
|
-
*/}
|
|
20
|
-
{giftCardProduct && (
|
|
21
|
-
<section class="py-16 md:py-24">
|
|
22
|
-
<a href="/gift-cards" class="max-w-wide mx-auto px-8 grid grid-cols-1 md:grid-cols-2 gap-8 md:gap-16 items-center group">
|
|
23
|
-
<div class="aspect-[4/3] bg-cream rounded-sm overflow-hidden">
|
|
24
|
-
{giftCardImage && (
|
|
25
|
-
<img
|
|
26
|
-
src={giftCardImage}
|
|
27
|
-
alt={giftCardProduct.image?.altText || giftCardProduct.name}
|
|
28
|
-
loading="lazy"
|
|
29
|
-
decoding="async"
|
|
30
|
-
class="w-full h-full object-cover"
|
|
31
|
-
/>
|
|
32
|
-
)}
|
|
33
|
-
</div>
|
|
34
|
-
<div class="flex flex-col gap-4">
|
|
35
|
-
<p class="eyebrow">A gift, considered</p>
|
|
36
|
-
<h2 class="font-display text-3xl leading-tight">{giftCardProduct.name}</h2>
|
|
37
|
-
<p class="text-ink-soft leading-relaxed">{giftCardProduct.description}</p>
|
|
38
|
-
<span class="text-sm tracking-wide uppercase mt-3">Send a gift card →</span>
|
|
39
|
-
</div>
|
|
40
|
-
</a>
|
|
41
|
-
</section>
|
|
42
|
-
)}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{/*
|
|
2
|
-
Navigation.astro contribution. Insert the line below immediately AFTER the
|
|
3
|
-
`<!-- nav:links -->` marker. ALSO add to the file's frontmatter:
|
|
4
|
-
|
|
5
|
-
import { getGiftCardProduct } from "../utils/gift-cards";
|
|
6
|
-
const giftCardsEnabled = (await getGiftCardProduct()) !== null;
|
|
7
|
-
|
|
8
|
-
Wrap the await in try/catch only if other awaits in the file are also
|
|
9
|
-
guarded (the helper itself never throws). The snippet itself is one line.
|
|
10
|
-
*/}
|
|
11
|
-
{giftCardsEnabled && <a href="/gift-cards">Gift Cards</a>}
|