@wix/agent-skills 1.14.0 → 1.15.1
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 +12 -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/DATA_COLLECTION.md +5 -3
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +25 -9
- package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
- package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
- 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/backend-event/COMMON-EVENTS.md +5 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +151 -0
- 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/COMPONENT-PREVIEW.md +57 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +23 -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 +18 -16
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
- package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
- package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
- package/skills/wix-app/references/stores/INVENTORY.md +37 -0
- package/skills/wix-app/references/stores/QUERY.md +87 -0
- package/skills/wix-app/references/stores/WRITE.md +55 -0
- 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 +89 -130
- package/skills/wix-headless/entry/bootstrap.mjs +93 -0
- package/skills/wix-headless/entry/skill.md +76 -0
- package/skills/wix-headless/references/AI_FEATURES.md +178 -0
- package/skills/wix-headless/references/CAPABILITIES.md +86 -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 +129 -0
- package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +99 -0
- package/skills/wix-headless/references/SEED.md +45 -187
- 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 +213 -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 +232 -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 +192 -0
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +155 -0
- package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +197 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +136 -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 +79 -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 +15 -0
- package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +71 -0
- package/skills/wix-manage/SKILL.md +29 -3
- package/skills/wix-manage/references/analytics/query-site-analytics.md +298 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
- package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +299 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +6 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +517 -0
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +218 -0
- package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
- package/skills/wix-manage/references/sites/site-import.md +270 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +57 -0
- package/skills/wix-vibe-headless/SKILL.md +142 -0
- package/skills/wix-vibe-headless/platforms/README.md +22 -0
- package/skills/wix-vibe-headless/platforms/base44.md +142 -0
- package/skills/wix-vibe-headless/platforms/generic.md +87 -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 +157 -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 +217 -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 +136 -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 +223 -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 +164 -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 +146 -0
- package/skills/wix-headless/references/BUILD-astro.md +0 -253
- 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/Layout.astro +0 -132
- 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/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 -140
- 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 -520
- 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 -154
- 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
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { wixApiRequest } from "./wix-client.js";
|
|
2
|
+
|
|
3
|
+
// Data model reference: see INSTRUCTIONS.md
|
|
4
|
+
// Event shape (for getEventBySlug): see wix-events-browse.js
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Wix Events Ticket Definition — a ticket type returned by the checkout/available-tickets endpoint.
|
|
8
|
+
* Full model: https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/orders/list-available-tickets
|
|
9
|
+
*
|
|
10
|
+
* id {string}, eventId {string}, name {string}, description {string},
|
|
11
|
+
* free {boolean} — true when the ticket is free,
|
|
12
|
+
* price { amount, currency } — the display price (use pricing.* for full detail),
|
|
13
|
+
* pricing ONE-OF:
|
|
14
|
+
* fixedPrice { amount, currency } — same price for everyone,
|
|
15
|
+
* minPrice { amount, currency } — minimum for "pay what you want" (donation); pass chosen amount as ticketInfo.guestPrice,
|
|
16
|
+
* pricingOptions.options [{ id, name, price { amount, currency } }] — tiered; pass chosen option id as ticketInfo.pricingOptionId,
|
|
17
|
+
* pricingType {string} — "STANDARD" | "DONATION" | "OPTIONS",
|
|
18
|
+
* saleStatus {string} — "SALE_STARTED" is the only buyable state,
|
|
19
|
+
* limitPerCheckout {number},
|
|
20
|
+
* orderIndex {number} — display order
|
|
21
|
+
*
|
|
22
|
+
* RSVP: { id, eventId, status ("YES"|"NO"|"WAITLIST"), totalGuests, firstName, lastName, email }
|
|
23
|
+
* status "WAITLIST" when the event is full and waitlist is enabled.
|
|
24
|
+
* Order: { orderNumber, status, totalPrice, ticketsPdf, tickets[] }
|
|
25
|
+
* status "FREE" → confirmed. status "INITIATED" → redirect to getTicketCheckoutUrl.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Submit an RSVP for an RSVP-type event (registration.type === "RSVP"). Completes client-side.
|
|
30
|
+
*
|
|
31
|
+
* Pass status "NO" only when event.registration.rsvp.responseType is "YES_AND_NO".
|
|
32
|
+
* If the event is full with a waitlist enabled, the RSVP comes back with status "WAITLIST".
|
|
33
|
+
* Throws on closed registration, guest-limit exceeded, duplicate email, or invalid form.
|
|
34
|
+
* https://dev.wix.com/docs/api-reference/business-solutions/events/registration/rsvp-v2/create-rsvp.md
|
|
35
|
+
*
|
|
36
|
+
* @param {string} eventId
|
|
37
|
+
* @param {{ firstName: string, lastName: string, email: string, status?: "YES"|"NO",
|
|
38
|
+
* additionalGuestNames?: string[], extraFields?: Record<string,string|string[]> }} guest
|
|
39
|
+
* @returns {Promise<object>} The created RSVP.
|
|
40
|
+
*/
|
|
41
|
+
export async function createRsvp(eventId, { firstName, lastName, email, status = "YES", additionalGuestNames = [], extraFields = {} } = {}) {
|
|
42
|
+
if (!firstName || !lastName || !email) throw new Error("createRsvp requires firstName, lastName, and email.");
|
|
43
|
+
|
|
44
|
+
// The built-in fields go TOP-LEVEL on rsvp — the API rejects them inside form.inputValues
|
|
45
|
+
// (400 "rsvp.firstName must not be empty"). form.inputValues is ONLY for the event's extra
|
|
46
|
+
// custom fields; sending a built-in-only form, or additionalGuestDetails when the event has no
|
|
47
|
+
// guest fields, throws INVALID_FORM_RESPONSE ("input additionalGuests/guestNames is unexpected").
|
|
48
|
+
const rsvp = { eventId, firstName, lastName, email, status };
|
|
49
|
+
|
|
50
|
+
const inputValues = [];
|
|
51
|
+
for (const [inputName, value] of Object.entries(extraFields)) {
|
|
52
|
+
inputValues.push(Array.isArray(value) ? { inputName, values: value } : { inputName, value });
|
|
53
|
+
}
|
|
54
|
+
if (inputValues.length) rsvp.form = { inputValues };
|
|
55
|
+
if (additionalGuestNames.length) {
|
|
56
|
+
rsvp.additionalGuestDetails = { guestCount: additionalGuestNames.length, guestNames: additionalGuestNames };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const res = await wixApiRequest("/events/v2/rsvps", { method: "POST", body: { rsvp } });
|
|
60
|
+
return res?.rsvp;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Query the buyable ticket definitions for a ticketed event (with availability).
|
|
65
|
+
*
|
|
66
|
+
* Uses GET /events/v1/checkout/available-tickets (WIX_EVENTS.READ_CHECKOUT) — the visitor-facing
|
|
67
|
+
* checkout endpoint. The V3 /ticket-definitions/query endpoint requires WIX_EVENTS.READ_TICKET_DEFINITIONS
|
|
68
|
+
* (scope SCOPE.DC-EVENTS.MANAGE-TICKET-DEF), an admin-only scope that anonymous visitor tokens do
|
|
69
|
+
* not carry, so it 403s in a headless SPA context.
|
|
70
|
+
*
|
|
71
|
+
* This endpoint already filters to non-hidden, SALE_STARTED tickets, so the result is ready to
|
|
72
|
+
* render directly. Pass includeSoldOut: false to additionally drop sold-out tiers.
|
|
73
|
+
*
|
|
74
|
+
* https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/orders/list-available-tickets
|
|
75
|
+
* @param {string} eventId
|
|
76
|
+
* @param {{ includeSoldOut?: boolean }} [options]
|
|
77
|
+
* @returns {Promise<object[]>}
|
|
78
|
+
*/
|
|
79
|
+
export async function queryTicketDefinitions(eventId, { includeSoldOut = true } = {}) {
|
|
80
|
+
const res = await wixApiRequest("/events/v1/checkout/available-tickets", {
|
|
81
|
+
method: "GET",
|
|
82
|
+
query: { eventId, limit: "100" },
|
|
83
|
+
});
|
|
84
|
+
let defs = res?.definitions ?? [];
|
|
85
|
+
if (!includeSoldOut) defs = defs.filter((d) => !d.salesDetails?.soldOut);
|
|
86
|
+
return defs;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reserve tickets for a limited time (typically 5–30 min) while the buyer completes checkout.
|
|
91
|
+
* Returns a reservation with status "PENDING" and an expirationDate.
|
|
92
|
+
* Throws if the reservation doesn't come back PENDING (e.g. tickets unavailable).
|
|
93
|
+
* https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/ticket-reservations/create-ticket-reservation.md
|
|
94
|
+
*
|
|
95
|
+
* @param {Array<{ ticketDefinitionId: string, quantity: number, guestPrice?: string, pricingOptionId?: string }>} tickets
|
|
96
|
+
* @returns {Promise<object>} The created reservation (id, expirationDate, tickets[], status).
|
|
97
|
+
*/
|
|
98
|
+
export async function reserveTickets(tickets) {
|
|
99
|
+
if (!Array.isArray(tickets) || !tickets.length) throw new Error("reserveTickets requires at least one ticket line.");
|
|
100
|
+
|
|
101
|
+
const lines = tickets.map(({ ticketDefinitionId, quantity, guestPrice, pricingOptionId }) => {
|
|
102
|
+
if (!ticketDefinitionId || !quantity) throw new Error("Each ticket line needs a ticketDefinitionId and quantity.");
|
|
103
|
+
const ticketInfo = {};
|
|
104
|
+
if (guestPrice !== undefined) ticketInfo.guestPrice = String(guestPrice);
|
|
105
|
+
if (pricingOptionId) ticketInfo.pricingOptionId = pricingOptionId;
|
|
106
|
+
const line = { ticketDefinitionId, quantity };
|
|
107
|
+
if (Object.keys(ticketInfo).length) line.ticketInfo = ticketInfo;
|
|
108
|
+
return line;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const res = await wixApiRequest("/events/v1/ticket-reservations", {
|
|
112
|
+
method: "POST",
|
|
113
|
+
body: { ticketReservation: { tickets: lines } },
|
|
114
|
+
});
|
|
115
|
+
const reservation = res?.ticketReservation;
|
|
116
|
+
if (!reservation?.id || reservation.status !== "PENDING") {
|
|
117
|
+
throw new Error(`Could not reserve tickets (status: ${reservation?.status ?? "unknown"}). They may be sold out.`);
|
|
118
|
+
}
|
|
119
|
+
return reservation;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Build the URL of the Wix-hosted ticket form for a reservation. Use this for ALL paid tickets
|
|
124
|
+
* (and free tickets too). The buyer fills in guest details and pays on Wix's page, then returns.
|
|
125
|
+
* Redirect with: window.location.href = getTicketCheckoutUrl(event, reservation.id)
|
|
126
|
+
*
|
|
127
|
+
* event must have been fetched with the URLS fieldset (getEventBySlug already does this).
|
|
128
|
+
* https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/orders/checkout.md
|
|
129
|
+
*
|
|
130
|
+
* @param {object} event Event from getEventBySlug (needs eventPageUrl).
|
|
131
|
+
* @param {string} reservationId From reserveTickets.
|
|
132
|
+
* @returns {string} Absolute hosted ticket-form URL.
|
|
133
|
+
*/
|
|
134
|
+
export function getTicketCheckoutUrl(event, reservationId) {
|
|
135
|
+
const base = event?.eventPageUrl?.base;
|
|
136
|
+
const path = event?.eventPageUrl?.path;
|
|
137
|
+
if (!base || !path) throw new Error("Event is missing eventPageUrl — fetch it with getEventBySlug (URLS fieldset).");
|
|
138
|
+
if (!reservationId) throw new Error("getTicketCheckoutUrl requires a reservationId from reserveTickets.");
|
|
139
|
+
return `${base}${path}/ticket-form?reservationId=${encodeURIComponent(reservationId)}`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Check out a reservation via REST — creates the order and assigns guests.
|
|
144
|
+
* Use this ONLY for FREE ticket orders (no redirect needed): the returned order has
|
|
145
|
+
* status "FREE", a ticketsPdf, and generated tickets[].
|
|
146
|
+
*
|
|
147
|
+
* For PAID tickets, this throws and tells you to redirect to getTicketCheckoutUrl instead.
|
|
148
|
+
* https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/orders/checkout.md
|
|
149
|
+
*
|
|
150
|
+
* @param {string} eventId
|
|
151
|
+
* @param {{ reservationId: string,
|
|
152
|
+
* buyer?: { firstName: string, lastName: string, email: string },
|
|
153
|
+
* guests: Array<{ firstName: string, lastName: string, email: string, extraFields?: Record<string,string|string[]> }> }} details
|
|
154
|
+
* @returns {Promise<object>} The created order (orderNumber, status, ticketsPdf, tickets[]).
|
|
155
|
+
*/
|
|
156
|
+
export async function checkoutTickets(eventId, { reservationId, buyer, guests } = {}) {
|
|
157
|
+
if (!eventId || !reservationId) throw new Error("checkoutTickets requires eventId and reservationId.");
|
|
158
|
+
if (!Array.isArray(guests) || !guests.length) throw new Error("checkoutTickets requires at least one guest.");
|
|
159
|
+
|
|
160
|
+
const toForm = ({ firstName, lastName, email, extraFields = {} }) => {
|
|
161
|
+
const inputValues = [
|
|
162
|
+
{ inputName: "firstName", value: firstName },
|
|
163
|
+
{ inputName: "lastName", value: lastName },
|
|
164
|
+
{ inputName: "email", value: email },
|
|
165
|
+
];
|
|
166
|
+
for (const [inputName, value] of Object.entries(extraFields)) {
|
|
167
|
+
inputValues.push(Array.isArray(value) ? { inputName, values: value } : { inputName, value });
|
|
168
|
+
}
|
|
169
|
+
return { form: { inputValues } };
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const body = { reservationId, guests: guests.map(toForm) };
|
|
173
|
+
if (buyer) body.buyer = buyer;
|
|
174
|
+
|
|
175
|
+
const res = await wixApiRequest(`/events/v1/events/${encodeURIComponent(eventId)}/tickets/checkout`, {
|
|
176
|
+
method: "POST",
|
|
177
|
+
body,
|
|
178
|
+
});
|
|
179
|
+
const order = res?.order;
|
|
180
|
+
const status = order?.status;
|
|
181
|
+
if (status === "INITIATED" || status === "PENDING") {
|
|
182
|
+
throw new Error(
|
|
183
|
+
`Order ${order?.orderNumber ?? ""} needs payment (status: ${status}). Redirect the buyer to getTicketCheckoutUrl(event, reservationId) to pay on the hosted ticket form.`,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
return order;
|
|
187
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
|
|
2
|
+
# Wix Members — custom login (client-only REST)
|
|
3
|
+
|
|
4
|
+
> **Source files (in this skill):** the shared transport `references/shared/wix-client.js` and this
|
|
5
|
+
> vertical's `references/members/wix-members-auth.js`. Copy **both** into your app's `src/rest/` side by
|
|
6
|
+
> side — the helper does `import { … } from "./wix-client.js"`, so they must land in the same folder.
|
|
7
|
+
|
|
8
|
+
Adds real **member accounts** to a client-only headless front end: sign up, log in, log out, and
|
|
9
|
+
member-gated surfaces — all from the browser over the public `WIX_CLIENT_ID`, no SDK, no backend.
|
|
10
|
+
|
|
11
|
+
**This is *custom* login: the front owns its login UI.** The member types credentials in **your own
|
|
12
|
+
form on your own page** (or clicks your own social button) — they are **never redirected to a
|
|
13
|
+
Wix-hosted login page**. This is the REST equivalent of the SDK `OAuthStrategy` recipe; the older
|
|
14
|
+
"redirect the user to a Wix login page" flow is deliberately **not** used here.
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
- User wants members to **sign up / log in** on a page they built (email+password, "Continue with
|
|
18
|
+
Google/Facebook", or custom SSO), with the login UI living in their own app.
|
|
19
|
+
- User wants **member-gated** content, an **account / profile** page, or a "my orders / my bookings /
|
|
20
|
+
my plans" view (those reads need a logged-in member).
|
|
21
|
+
- **Pricing-plans is present.** Buying/reading a member's plans is members-only — pair this vertical
|
|
22
|
+
with `pricing-plans` so the member can log in *before* the subscribe / "my subscription" surface.
|
|
23
|
+
|
|
24
|
+
## Two mechanisms — pick by the brief (a page may use both)
|
|
25
|
+
|
|
26
|
+
| | **(A) Direct-credential** | **(B) Social / SSO** |
|
|
27
|
+
| :-- | :-- | :-- |
|
|
28
|
+
| **Use when** | your own email+password form, or custom sign-up fields | "Sign in with Google / Facebook", or enterprise SSO |
|
|
29
|
+
| **User leaves your page?** | **No** — silent iframe token exchange | **Yes** — full-page redirect to the provider, back to your `/callback` |
|
|
30
|
+
| **Kick-off** | `register()` / `login()` | `startSocialLogin(idp, callbackUri)` |
|
|
31
|
+
| **Finish** | automatic on `SUCCESS` | `completeSocialLogin()` on the `/callback` page |
|
|
32
|
+
| **Custom sign-up fields?** | Yes (`register`'s `profile`) | No — the provider owns the identity |
|
|
33
|
+
| **Needs an allow-listed origin/URI?** | **Yes** — your app **origin** (postMessage target) | **Yes** — your `/callback` **URL** |
|
|
34
|
+
|
|
35
|
+
Both converge on the **same end state**: member tokens written onto the shared client, so **every
|
|
36
|
+
later `wixApiRequest` runs as the member** (login just swaps the token set on the client you already
|
|
37
|
+
have). Don't blend their exchange calls — the helper handles each internally.
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
1. A Wix site with the **Members Area app installed** if you need member *profile* data (name, photo,
|
|
41
|
+
roles) or custom field definitions. Pure "logged-in vs. not" gating needs no app — see the
|
|
42
|
+
identity-vs-profile split below.
|
|
43
|
+
2. The site's public headless **`WIX_CLIENT_ID`** (from the handoff prompt), pasted into
|
|
44
|
+
`src/rest/wix-client.js`. Public, buyer-facing credential — safe to hardcode/commit.
|
|
45
|
+
3. **OAuth-app allow-listing — the #1 gotcha. Two *different* fields gate the two mechanisms:**
|
|
46
|
+
|
|
47
|
+
| Mechanism | What must be allow-listed | OAuth-app field | On `localhost:4321`? |
|
|
48
|
+
| :-- | :-- | :-- | :-- |
|
|
49
|
+
| **(A) direct-credential** | your app **origin** (the hidden iframe `postMessage`s the code back to it) | `allowedRedirectDomains` | ✅ allowed by default |
|
|
50
|
+
| **(B) social / SSO** | the **exact `/callback` URL** (full-page redirect target) | `allowedRedirectUris` | ❌ **must be added** |
|
|
51
|
+
|
|
52
|
+
- `localhost:4321` is Wix's default-allowed dev **origin**, so **credential login works there with zero
|
|
53
|
+
setup**. But social **still fails on `localhost:4321`** until you add `http://localhost:4321/callback`
|
|
54
|
+
to `allowedRedirectUris` — the default covers the origin, not the callback URI. (These are genuinely
|
|
55
|
+
two separate fields; matching Oz's SDK `wix-headless` `managed/DEPLOYMENT.md`.)
|
|
56
|
+
- **Any non-default origin** — your deployed domain, a different localhost port —
|
|
57
|
+
must be registered too: the origin (for A) and the `<origin>/callback` (for B).
|
|
58
|
+
- **Symptoms:** (A) unregistered origin → login hangs, then `MemberAuthError('timeout')` + a console
|
|
59
|
+
*"Failed to execute 'postMessage'… target origin … does not match"*. (B) unregistered callback →
|
|
60
|
+
the Wix authorize page shows *"Invalid redirect URI. Please add an allowed URI to your OAuth App"*
|
|
61
|
+
**before** returning — so the client can't catch it; you must register it up front.
|
|
62
|
+
- Google & Facebook are enabled by default; **custom SSO** also needs an IDP connection created in
|
|
63
|
+
the Business Manager, whose **connection id** you pass as `idp` (see "Custom SSO" below).
|
|
64
|
+
|
|
65
|
+
> **⚠️ AGENT: this is a manual, owner-only step you cannot do from client-only code — surface it
|
|
66
|
+
> proactively.** As soon as a run uses social/SSO (or deploys credential login to a non-`4321`
|
|
67
|
+
> origin), **tell the user** the exact URIs to add and where, and note that **social login stays
|
|
68
|
+
> dead until they do it** (a client-only front has no account token to register it via the API).
|
|
69
|
+
> See "Point the user to their dashboard" below for the deep link and the exact values.
|
|
70
|
+
|
|
71
|
+
## The API (copy as-is; do not re-derive it)
|
|
72
|
+
Copy `wix-client.js` + `wix-members-auth.js` into `src/rest/` and set `WIX_CLIENT_ID`. Exports of
|
|
73
|
+
`wix-members-auth.js`:
|
|
74
|
+
- **Direct-credential:** `register(email, password, profile?)`, `login(email, password)`,
|
|
75
|
+
`verifyEmail(code, stateToken)`, `sendPasswordResetEmail(email, redirectUri)`
|
|
76
|
+
- **Social / SSO:** `startSocialLogin(idp, callbackUri, returnTo?)`, `completeSocialLogin()`, `IDP`
|
|
77
|
+
- **Session:** `isLoggedIn()`, `getCurrentMember()`, `logout(returnTo?)`
|
|
78
|
+
- **Errors:** `MemberAuthError` (`.code` + `.message`)
|
|
79
|
+
|
|
80
|
+
The full state-machine, `profile`, and error semantics are documented as JSDoc at the top of
|
|
81
|
+
`wix-members-auth.js`. **Read it before wiring the UI.**
|
|
82
|
+
|
|
83
|
+
> **⚠️ Copy `wix-members-auth.js` verbatim — do NOT rewrite its internals.** Wire the UI to the
|
|
84
|
+
> exported functions, but leave the helper's bodies alone. The OAuth request shapes are **exact and
|
|
85
|
+
> unforgiving** — the `createRedirectSession` body in particular needs the `auth.authRequest` wrapper,
|
|
86
|
+
> flat PKCE fields, and `responseType`/`scope`; "simplifying" it into a spread of the input object
|
|
87
|
+
> returns **400 Bad Request** and login dies. Extend by *calling* the exports, not by editing them.
|
|
88
|
+
|
|
89
|
+
## How to wire it (UI is the project's choice — the skill ships the REST layer only)
|
|
90
|
+
|
|
91
|
+
### (A) Credential form + the state machine — handle every branch (not just SUCCESS)
|
|
92
|
+
`register()` / `login()` / `verifyEmail()` resolve to `{ state, member?, stateToken? }`:
|
|
93
|
+
- **`"SUCCESS"`** → logged in; `member` is populated (or `null` if the Members Area app isn't
|
|
94
|
+
installed). Render the account UI / navigate.
|
|
95
|
+
- **`"REQUIRE_EMAIL_VERIFICATION"`** → a 6-digit code was emailed. Collect it and call
|
|
96
|
+
`verifyEmail(code, stateToken)`. (Fires when a new registrant's email already exists as a contact,
|
|
97
|
+
or when email verification is enabled in Member Settings.)
|
|
98
|
+
- **`"REQUIRE_OWNER_APPROVAL"`** → show a "pending approval" notice; not an error.
|
|
99
|
+
|
|
100
|
+
Hard failures **throw** a `MemberAuthError` — catch it and show `err.message` (`.code` is stable:
|
|
101
|
+
`invalidCredentials`, `emailAlreadyExists`, …). `emailAlreadyExists` on register → route to log in.
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
import { login, register, verifyEmail, isLoggedIn, getCurrentMember, logout, MemberAuthError } from "./rest/wix-members-auth.js";
|
|
105
|
+
try {
|
|
106
|
+
const res = await login(email, password);
|
|
107
|
+
if (res.state === "SUCCESS") showAccount(res.member);
|
|
108
|
+
else if (res.state === "REQUIRE_EMAIL_VERIFICATION") promptForCode(res.stateToken);
|
|
109
|
+
else if (res.state === "REQUIRE_OWNER_APPROVAL") showPending();
|
|
110
|
+
} catch (e) {
|
|
111
|
+
if (e instanceof MemberAuthError) showError(e.message); else throw e;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Custom sign-up fields go in `register`'s `profile` (`{ firstName, lastName, nickname, addresses, … }`).
|
|
116
|
+
Standard fields work as-is; arbitrary `customFields` keys must first be defined in the Members Area
|
|
117
|
+
app or they're silently dropped.
|
|
118
|
+
|
|
119
|
+
### (B) Social / SSO — your button + a `/callback` route
|
|
120
|
+
```js
|
|
121
|
+
// on your login page:
|
|
122
|
+
import { startSocialLogin, IDP } from "./rest/wix-members-auth.js";
|
|
123
|
+
const callbackUri = new URL("/callback", window.location.origin).href; // must be allow-listed
|
|
124
|
+
onGoogleClick = () => startSocialLogin(IDP.GOOGLE, callbackUri, window.location.pathname);
|
|
125
|
+
onFacebookClick = () => startSocialLogin(IDP.FACEBOOK, callbackUri, window.location.pathname);
|
|
126
|
+
|
|
127
|
+
// on the /callback page (a route/page at exactly that path):
|
|
128
|
+
import { completeSocialLogin } from "./rest/wix-members-auth.js";
|
|
129
|
+
const { member, returnTo } = await completeSocialLogin();
|
|
130
|
+
window.location.replace(returnTo || "/");
|
|
131
|
+
```
|
|
132
|
+
**Custom SSO:** identical call — pass your connection id as `idp` instead of `IDP.GOOGLE`:
|
|
133
|
+
`startSocialLogin("<connectionId>", callbackUri)`. The connection id comes from an IDP connection you
|
|
134
|
+
create in the Business Manager (dashboard link below).
|
|
135
|
+
|
|
136
|
+
### Session, account area, logout
|
|
137
|
+
- **Gate UI** on `isLoggedIn()`. Read the member with `await getCurrentMember()` (name / photo / roles
|
|
138
|
+
/ custom fields) — returns `null` for a visitor or when the Members Area app isn't installed.
|
|
139
|
+
- **Logout:** `await logout()` — clears local tokens and redirects through the Wix logout URL; the
|
|
140
|
+
client is a clean anonymous visitor afterward.
|
|
141
|
+
- **Persistence is automatic.** Member tokens live in the same `localStorage` the visitor token used,
|
|
142
|
+
so a reload stays logged in and tokens auto-refresh via `wix-client.js` — do **not** add your own.
|
|
143
|
+
|
|
144
|
+
## Identity vs. profile — don't conflate them
|
|
145
|
+
- **Identity / auth** — sign up, log in, log out, "is this caller a member?". Native to the headless
|
|
146
|
+
OAuth app. **No app install needed** — every login mechanism here runs on this layer alone.
|
|
147
|
+
- **Member profile / Members Area** — name / photo / roles, an account page, and custom-field
|
|
148
|
+
definitions. Served by the **Members Area app**, which must be installed. If `getCurrentMember()`
|
|
149
|
+
returns `null` while `isLoggedIn()` is `true`, suspect the app isn't installed — not a code bug.
|
|
150
|
+
|
|
151
|
+
## Hard rules (do not violate)
|
|
152
|
+
- ✅ **Custom login only.** The member logs in on **your** UI; never redirect them to a Wix-hosted
|
|
153
|
+
login page, and never use a Wix login-page redirect for member auth.
|
|
154
|
+
- ✅ **One shared client.** Member login swaps the token set on `wix-client.js` — reuse the same
|
|
155
|
+
transport for everything so the member identity (and their cart) carries across the app. Never mint
|
|
156
|
+
a second client or re-mint anonymously after login (it drops the member).
|
|
157
|
+
- ✅ **For a Wix-backed feature, use the Wix member as the identity — keep it consistent.** When the
|
|
158
|
+
feature is about **Wix members** (the user gave you a `WIX_CLIENT_ID`), log in and gate on the
|
|
159
|
+
**Wix member** (`getCurrentMember()` / the Wix member token), and key member-owned Wix rows on
|
|
160
|
+
`_owner` (see the `cms` vertical). Don't identify one feature's user from two different sessions —
|
|
161
|
+
the ids won't match.
|
|
162
|
+
- ❌ **Don't blend the two exchanges.** Credential login finishes via the hidden iframe; social
|
|
163
|
+
finishes via `/callback`. The helper keeps them separate — don't cross-wire.
|
|
164
|
+
- ❌ **Never fake a member.** No mock "logged-in" state, no invented profile, roles, or member counts.
|
|
165
|
+
Render the real member or the logged-out state.
|
|
166
|
+
- ✅ **Fail loudly.** The helper throws `MemberAuthError` on bad credentials, state mismatch, timeout,
|
|
167
|
+
and token-exchange failure — surface them; don't swallow.
|
|
168
|
+
- ⛔ **No `elevate` / admin scope.** A member reading their **own** data (profile, own orders /
|
|
169
|
+
bookings / plans) is authorized by the member token alone. There is no admin elevation on a
|
|
170
|
+
client-only front, and own-data reads don't need it.
|
|
171
|
+
- ⛔ **MFA / TOTP is not available headless.** The security layers are password + email verification +
|
|
172
|
+
reCAPTCHA, all **dashboard-governed** — document them as host-configurable, don't set them from code.
|
|
173
|
+
|
|
174
|
+
## Beyond the snippets
|
|
175
|
+
The helper covers sign-up / login / social / SSO / logout / current-member. For a genuine gap, extend
|
|
176
|
+
with `wixApiRequest` — but confirm the endpoint, method, and body in the API reference first (or via
|
|
177
|
+
the co-installed **`wix-docs`** skill). Never guess.
|
|
178
|
+
- Custom login (JS SDK, concepts mirror the REST calls): https://dev.wix.com/docs/go-headless/self-managed-headless/authentication/members/custom-login-page/custom-login/custom-login-using-the-js-sdk.md
|
|
179
|
+
- External / social login (REST): https://dev.wix.com/docs/rest/business-management/headless-authentication/redirects/create-redirect-session
|
|
180
|
+
- Retrieve Tokens (REST): https://dev.wix.com/docs/rest/business-management/headless-authentication/authentication/retrieve-tokens
|
|
181
|
+
- Members API (read/update profile, query members): https://dev.wix.com/docs/api-reference/members/members/members-v1/introduction
|
|
182
|
+
|
|
183
|
+
## Point the user to their dashboard
|
|
184
|
+
Some setup only happens in the Wix dashboard — always give the user the deep links:
|
|
185
|
+
- **Members Area app** (for profile data + custom fields) — `https://manage.wix.com/dashboard/{metaSiteId}/member-permissions`
|
|
186
|
+
- **Signup security** (email verification, owner approval, reCAPTCHA) — `Dashboard → Settings → Login & Security` / member signup settings
|
|
187
|
+
- **Allowed authorization redirect URIs** — the OAuth-app / **Headless Settings** for the project:
|
|
188
|
+
`https://manage.wix.com/dashboard/{metaSiteId}/oauth-apps-settings`. Add:
|
|
189
|
+
- the **app origin** (e.g. `https://myapp.example.com`) — needed for direct-credential login from a
|
|
190
|
+
non-default origin (`localhost:4321` is pre-allowed);
|
|
191
|
+
- the **exact `/callback` URL** (e.g. `https://myapp.example.com/callback`) — required for social/SSO;
|
|
192
|
+
- also add password-reset / logout return URLs if you use them.
|
|
193
|
+
Tell the user these exact values; the callback URL must match your `startSocialLogin` `callbackUri`
|
|
194
|
+
character-for-character.
|
|
195
|
+
- **Custom SSO connection** (to obtain a `connectionId`) — created under the project's IAM / SSO
|
|
196
|
+
settings in the Business Manager.
|
|
197
|
+
|
|
198
|
+
Substitute the site's `metaSiteId` (from the handoff / `ListWixSites`).
|
|
199
|
+
|
|
200
|
+
## Verification checklist (before declaring done)
|
|
201
|
+
- [ ] `WIX_CLIENT_ID` set to the prompt's value (not the `<YOUR-CLIENT-ID>` placeholder)
|
|
202
|
+
- [ ] Sign-up: `register()` returns `SUCCESS` (or `REQUIRE_EMAIL_VERIFICATION` handled via `verifyEmail`)
|
|
203
|
+
- [ ] Log-in: `login()` reaches `SUCCESS`; wrong password shows `invalidCredentials`, not a crash
|
|
204
|
+
- [ ] After login `isLoggedIn()` is `true` and `getCurrentMember()` returns the member (or `null` with
|
|
205
|
+
the Members Area app not installed — documented, not a bug)
|
|
206
|
+
- [ ] A member-scoped read (e.g. pricing-plans "my plans") now returns the member's data via the same client
|
|
207
|
+
- [ ] Social: the button redirects to the provider and `/callback` logs the member in (callback URL
|
|
208
|
+
allow-listed); custom SSO works with its `connectionId` (or is flagged as pending host setup)
|
|
209
|
+
- [ ] Logout clears the session and the next load is a clean anonymous visitor
|
|
210
|
+
- [ ] No mocked member state, profile, or roles anywhere
|
|
211
|
+
- [ ] Told the user about any required dashboard setup (Members Area app, allowed redirect URIs) with deep links
|