{"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-events-badges-v1-event-badges-spi.public.ts","../../src/interfaces-events-badges-v1-event-badges-spi.context.ts"],"sourcesContent":["/** Request from Wix asking for a badge for a specific event. */\nexport interface GetEventBadgeRequest {\n  /**\n   * Event for which Wix is requesting a badge.\n   *\n   * Contains the event ID, title, publication date, and optional ticket summary.\n   */\n  event?: Event;\n}\n\n/** Event for which a badge is being requested. */\nexport interface Event {\n  /**\n   * Event ID.\n   * Identifies the Wix Events event being evaluated for a badge.\n   * @format GUID\n   */\n  _id?: string | null;\n  /**\n   * Event title.\n   * Contains the title configured by the site owner.\n   * @minLength 1\n   * @maxLength 120\n   */\n  title?: string | null;\n  /**\n   * Date and time the event was published.\n   * Represents the publish timestamp for the event.\n   */\n  publishedDate?: Date | null;\n  /**\n   * Summary of ticket pricing and availability for the event.\n   *\n   * Present only for ticketed events.\n   */\n  ticketsSummary?: TicketsSummary;\n}\n\n/** Snapshot of ticket pricing and availability for the event, calculated at the time of the call. */\nexport interface TicketsSummary {\n  /**\n   * Number of tickets still available for purchase across all on-sale ticket\n   * definitions on the event. Unset when availability is unlimited.\n   * @readonly\n   */\n  availableTicketsCount?: number | null;\n  /**\n   * Lowest ticket price for the event.\n   * Calculated across all ticket definitions on the event.\n   * @readonly\n   */\n  lowestTicketPrice?: Money;\n  /**\n   * Highest ticket price for the event.\n   * Calculated across all ticket definitions on the event.\n   * @readonly\n   */\n  highestTicketPrice?: Money;\n  /**\n   * Formatted lowest ticket price.\n   * Includes the event currency for site-visitor display.\n   * @maxLength 50\n   * @readonly\n   */\n  lowestTicketPriceFormatted?: string | null;\n  /**\n   * Formatted highest ticket price.\n   * Includes the event currency for site-visitor display.\n   * @maxLength 50\n   * @readonly\n   */\n  highestTicketPriceFormatted?: string | null;\n  /**\n   * Whether ticket availability is limited for this event.\n   *\n   * `false` when availability is unlimited or the event has no ticket definitions.\n   * @readonly\n   */\n  hasLimitedTickets?: boolean | null;\n}\n\n/**\n * Money.\n * Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.\n */\nexport interface Money {\n  /**\n   * Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.\n   * @format DECIMAL_VALUE\n   */\n  value?: string;\n  /**\n   * Currency code. Must be valid ISO 4217 currency code (e.g., USD).\n   * @format CURRENCY\n   */\n  currency?: string;\n}\n\n/** Response returned by your implementation. */\nexport interface GetEventBadgeResponse {\n  /**\n   * Badge returned for the event card.\n   *\n   * Omit the field, or leave it unset, when no badge applies to the event.\n   */\n  badge?: Badge;\n}\n\n/** Badge returned by the service plugin implementer for display on an event card. */\nexport interface Badge {\n  /** Rendering priority used to rank badges when multiple implementers return a badge for the same event. The downstream UI selects the badge with the highest priority and uses the implementer's most recent edit time as the tie-breaker. */\n  badgeType?: BadgeType;\n  /**\n   * Text shown on the event card. Returned as-is in whatever language the implementer chooses, with no translation by Wix.\n   * @maxLength 50\n   */\n  text?: string | null;\n}\n\n/** Rendering priority bucket used by the storefront UI to rank multiple badges on the same event. */\nexport enum BadgeType {\n  /** Highest priority. Use for badges that should outrank all others, such as \"Sold out\" or \"Cancelled\". */\n  FIRST_PRIORITY = 'FIRST_PRIORITY',\n  /** Medium priority. Use for major contextual labels, such as \"Selling fast\" or \"Early bird\". */\n  SECOND_PRIORITY = 'SECOND_PRIORITY',\n  /** Lowest priority. Use for nice-to-have hints, such as \"New\" or \"Featured\". */\n  THIRD_PRIORITY = 'THIRD_PRIORITY',\n}\n\n/** Configuration provided when installing the Event Badges service plugin extension. */\nexport interface EventBadgesSpiConfig {\n  /**\n   * Base URI where the service plugin implementation is deployed.\n   *\n   * Wix appends the method path to this URI when calling the implementation.\n   */\n  baseUri?: SpiBaseUri;\n  /**\n   * List of event IDs this extension applies to.\n   *\n   * When empty, Wix considers the extension applicable to every event on the site.\n   * @maxSize 100\n   * @format GUID\n   */\n  eventId?: string[];\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n  /**\n   * Base URI for your service plugin. Wix appends each method's path to this URI.\n   *\n   * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n   * @minLength 6\n   * @maxLength 2048\n   */\n  baseUri?: string;\n  /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n  alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n  /**\n   * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n   * @minLength 3\n   * @maxLength 128\n   */\n  methodName?: string;\n  /**\n   * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n   *\n   * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n   * @minLength 6\n   * @maxLength 2048\n   */\n  absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n  /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n  requestId?: string | null;\n  /**\n   * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n   * @format CURRENCY\n   */\n  currency?: string | null;\n  /** An object that describes the identity that triggered this request. */\n  identity?: IdentificationData;\n  /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n  languages?: string[];\n  /**\n   * The service provider app's instance ID.\n   * @format GUID\n   */\n  instanceId?: string | null;\n  /**\n   * Extension ID in Dev Center.\n   * @internal\n   * @maxLength 256\n   */\n  appExtensionId?: string | null;\n  /**\n   * Extension type in Dev Center.\n   * @internal\n   * @maxLength 256\n   */\n  appExtensionType?: string | null;\n  /**\n   * Invoked function.\n   * @internal\n   * @maxLength 256\n   */\n  functionName?: string | null;\n}\n\nexport enum IdentityType {\n  UNKNOWN = 'UNKNOWN',\n  ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n  MEMBER = 'MEMBER',\n  WIX_USER = 'WIX_USER',\n  APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n  /**\n   * ID of a site visitor that has not logged in to the site.\n   * @format GUID\n   */\n  anonymousVisitorId?: string;\n  /**\n   * ID of a site visitor that has logged in to the site.\n   * @format GUID\n   */\n  memberId?: string;\n  /**\n   * ID of a Wix user (site owner, contributor, etc.).\n   * @format GUID\n   */\n  wixUserId?: string;\n  /**\n   * ID of an app.\n   * @format GUID\n   */\n  appId?: string;\n  /** @readonly */\n  identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n  /**\n   * ID of a site visitor that has not logged in to the site.\n   * @format GUID\n   */\n  anonymousVisitorId?: string;\n  /**\n   * ID of a site visitor that has logged in to the site.\n   * @format GUID\n   */\n  memberId?: string;\n  /**\n   * ID of a Wix user (site owner, contributor, etc.).\n   * @format GUID\n   */\n  wixUserId?: string;\n  /**\n   * ID of an app.\n   * @format GUID\n   */\n  appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n  Context,\n  GetEventBadgeRequest,\n  GetEventBadgeResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n  renameKeysFromSDKRequestToRESTRequest,\n  renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nconst TRANSFORM_PATHS_0 = [{ path: 'request.event.publishedDate' }];\n\nexport interface GetEventBadgeEnvelope {\n  request: GetEventBadgeRequest;\n  metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n  /**\n   *\n   * Returns a badge to display on a specific event.\n   *\n   * Wix calls this method synchronously when the storefront or dashboard reads\n   * events with the `BADGES` fieldset requested. For each event in the read\n   * pipeline, Wix fans out to every applicable installed implementer in parallel.\n   *\n   * Wix uses the returned `badge` to surface contextual information on the event\n   * card. If multiple badges apply, downstream UI ranks them by `badgeType`\n   * priority and most recent implementer edit time. Aggregated badge results are\n   * cached per site and event.\n   *\n   * **Error handling:** If your implementation returns an error or times out, Wix\n   * logs the failure and omits your badge for that request. Other implementers'\n   * badges can still appear, and no retries are performed at the service plugin layer. */\n  getEventBadge(\n    payload: GetEventBadgeEnvelope\n  ): GetEventBadgeResponse | Promise<GetEventBadgeResponse>;\n}>('EVENTS_EVENT_BADGES', [\n  {\n    name: 'getEventBadge',\n    primaryHttpMappingPath: '/v1/event-badge',\n    transformations: {\n      toREST: (payload: any) => {\n        const toRestResponse = payload;\n\n        return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n      },\n      fromREST: (payload: any) => {\n        const fromRestRequest = transformPaths(payload, [\n          {\n            transformFn: transformRESTTimestampToSDKTimestamp,\n            paths: TRANSFORM_PATHS_0,\n          },\n        ]);\n\n        return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n      },\n    },\n  },\n]);\n","import './interfaces-events-badges-v1-event-badges-spi.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-events-badges-v1-event-badges-spi.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n  typeof publicProvideHandlers\n> &\n  typeof publicProvideHandlers = /*#__PURE__*/ createServicePluginModule(\n  publicProvideHandlers\n);\n"],"mappings":";AAwHO,IAAK,YAAL,kBAAKA,eAAL;AAEL,EAAAA,WAAA,oBAAiB;AAEjB,EAAAA,WAAA,qBAAkB;AAElB,EAAAA,WAAA,oBAAiB;AANP,SAAAA;AAAA,GAAA;AA6GL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACrOZ,SAAS,+BAA+B;AAMxC,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,IAAM,oBAAoB,CAAC,EAAE,MAAM,8BAA8B,CAAC;AAO3D,IAAM,kBAAkB,wBAoB5B,uBAAuB;AAAA,EACxB;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB,eAAe,SAAS;AAAA,UAC9C;AAAA,YACE,aAAa;AAAA,YACb,OAAO;AAAA,UACT;AAAA,QACF,CAAC;AAED,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AC7DD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGkC;AAAA,EAC7C;AACF;","names":["BadgeType","IdentityType","provideHandlers"]}