All skills
wix avatar

/wix-app

@dc6f1fa official
by Wix.comwix/skills33 stars
33

Build and review Wix CLI app extensions — dashboard pages, modals, plugins, menu plugins, custom element widgets, Editor React components, site plugins, embedded scripts, backend APIs, backend events, service plugins, data collections, and App Market readiness. Use when building ANY feature or extension for a Wix CLI app or preparing a Wix app for App Market review. Triggers on: add, build, create, implement, help me, dashboard, widget, plugin, backend, API, event, collection, embedded script, service plugin, Editor React component, checkout, shipping, tax, discount, SPI, CMS, schema, tracking, popup, admin panel, menu item, modal, validate, test, verify, register extension, App Market, app review, submission readiness.

Use this Skill: https://skilld.dev/gh/wix/skills/wix-app

This session only. Nothing lands on disk.

referencesservice-pluginBOOKINGS-STAFF-SORTING.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Bookings Staff Sorting Provider Service Plugin Reference

Overview

The Staff Sorting Provider SPI lets you implement custom staff assignment algorithms for Wix Bookings. When a booking slot has multiple available staff members, Wix calls your plugin to determine the priority order. Implement the sortStaffMembers handler — it returns the available staff members reordered by priority.

FQDN: wix.interfaces.resources.sorting.v1.staff_sorting_provider

Request and Response Schema

Before implementing, call ReadFullDocsMethodSchema on the docs URL to get the full request/response types.

Handler Docs URL
sortStaffMembers https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/staff-sorting-service-plugin/sort-staff-members?apiView=SDK

Important constraints:

  • You must return the exact same IDs from availableResourceIds, reordered by priority
  • Do not add or remove any IDs
  • If your response is invalid, Wix falls back to random assignment

Performance Requirements

  • Hard limit: Response must be returned within 5 seconds
  • Recommended: Keep response time under 500ms for optimal user experience

Example: Workload Balancing

This example sorts staff members to balance workload by prioritizing those with fewer recent bookings.

import { staffSorting } from "@wix/bookings/service-plugins";
import { auth } from "@wix/essentials";
import { extendedBookings } from "@wix/bookings";

staffSorting.provideHandlers({
  sortStaffMembers: async (payload) => {
    const { request } = payload;
    // availableResourceIds is optional on the request type — default it, or
    // spreading/iterating it below fails `tsc` with "possibly undefined."
    const { availableResourceIds = [], slot } = request;

    const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
    const elevatedQuery = auth.elevate(extendedBookings.queryExtendedBookings);
    const result = await elevatedQuery({
      filter: {
        "bookedEntity.item.slot.resource.id": { "$in": availableResourceIds },
        "startDate": { "$gte": sevenDaysAgo },
      },
      cursorPaging: { limit: 100 },
    });
    const recentBookings = result.extendedBookings ?? [];

    // Count bookings per staff member
    const bookingCounts = new Map<string, number>();
    for (const id of availableResourceIds) {
      bookingCounts.set(id, 0);
    }
    for (const booking of recentBookings) {
      const resourceId = booking.booking?.bookedEntity?.slot?.resource?._id;
      if (resourceId && bookingCounts.has(resourceId)) {
        bookingCounts.set(resourceId, (bookingCounts.get(resourceId) ?? 0) + 1);
      }
    }

    // Sort by fewest bookings first (balance workload)
    const sorted = [...availableResourceIds].sort(
      (a, b) => (bookingCounts.get(a) ?? 0) - (bookingCounts.get(b) ?? 0)
    );

    return {
      staff: sorted.map((resourceId) => ({ resourceId })),
    };
  },
});

Manual Setup Required

None. Confirmed live with a service that has 2 assigned staff — the dashboard's "Add booking" flow resolved a specific staff member from the plugin's sorted order, and the booking created successfully with no errors. No dashboard configuration is needed beyond having the app installed and released, and the service having 2+ staff assigned to genuinely exercise the sort.

Key Implementation Notes

  1. Return all IDs - You must return every ID from availableResourceIds, just reordered
  2. Performance matters - Keep logic fast; the booking flow waits for your response
  3. Elevate permissions - Use auth.elevate when querying Wix APIs from the handler
  4. Deterministic sorting - Use a tiebreaker (e.g., resource ID) when priorities are equal
  5. Use queryExtendedBookings, not query — extendedBookings.query is deprecated. queryExtendedBookings takes the same filter/cursorPaging shape, so it's a drop-in replacement; confirmed live after switching.
  6. availableResourceIds is optional on the request type — default it to [] when destructuring, or spreading/iterating it fails tsc with "possibly undefined."
  7. Graceful degradation - If your external data source is unavailable, return the original order rather than failing

Source: SKILL.md on GitHub

1 warningtoday4 checks · Risk SAFE
  • Gen Agent Trust Hubtoday

    This skill is a specialized development toolkit for building extensions on the Wix platform. It provides comprehensive instructions for creating dashboard pages, backend APIs, and site plugins using the Wix CLI and SDKs. No malicious patterns were detected; the skill's behaviors, such as dependency management, command execution for builds, and local script execution for code reviews, are entirely consistent with its purpose as a developer productivity tool for the Wix ecosystem.

  • Sockettoday

    1 alert: gptAnomaly

  • Snyktoday

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at dc6f1fa. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated yesterday
compatibility
requires `@wix/cli` >= 1.1.192.

README badge

README badge for wix/skills/wix-app

Builds dashboard pages, modals, plugins, custom widgets, Editor React components, backend APIs, events, service plugins, and data collections for Wix CLI apps. Provides decision logic, API patterns, and validation workflows; scaffolding is owned by the Wix CLI via `wix generate --params`.

Generated from the current SKILL.md.

What extension types does this skill cover?
All Wix CLI app extension types: dashboard pages, modals, plugins, menu plugins, custom element widgets, Editor React components, site plugins, embedded scripts, backend APIs, backend events, service plugins, and data collections.
Does this skill scaffold the extension files for me?
The Wix CLI owns scaffolding via `wix generate --params` for all extension types except Backend API. This skill provides decision logic, API guidance, and business-logic patterns to fill in the generated stubs. Backend API files must be created manually.
What Wix CLI version is required?
The skill requires @wix/cli >= 1.1.192.
Do I need to create a Data Collection extension for app-specific data?
Yes, if you're saving or persisting app-specific data, managing domain entities in a dashboard, or running a service plugin that reads app-configured data. The skill infers this automatically—you don't need to explicitly request it.
Does this skill cover Wix Stores API usage?
Yes. When using any Wix Stores API (products, inventory, orders), the skill requires dual V1/V3 catalog support and references the Stores Versioning guide for module selection and field mapping.

Generated from the current SKILL.md. These answers refresh after source changes.