@wix/auto_sdk_ecom_memberships 1.0.27 → 1.0.29

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.
Files changed (29) hide show
  1. package/build/cjs/index.d.ts +2 -2
  2. package/build/cjs/index.js +25 -0
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +3 -2
  5. package/build/cjs/index.typings.js +25 -0
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/{service-plugins-error-classes-B9LHoDJG.d.ts → service-plugins-error-classes-DC9BuykL.d.ts} +29 -3
  8. package/build/es/index.d.mts +2 -2
  9. package/build/es/index.mjs +23 -0
  10. package/build/es/index.mjs.map +1 -1
  11. package/build/es/index.typings.d.mts +3 -2
  12. package/build/es/index.typings.mjs +23 -0
  13. package/build/es/index.typings.mjs.map +1 -1
  14. package/build/es/{service-plugins-error-classes-B9LHoDJG.d.mts → service-plugins-error-classes-DC9BuykL.d.mts} +29 -3
  15. package/build/internal/cjs/index.d.ts +2 -2
  16. package/build/internal/cjs/index.js +25 -0
  17. package/build/internal/cjs/index.js.map +1 -1
  18. package/build/internal/cjs/index.typings.d.ts +3 -2
  19. package/build/internal/cjs/index.typings.js +25 -0
  20. package/build/internal/cjs/index.typings.js.map +1 -1
  21. package/build/internal/cjs/{service-plugins-error-classes-B9LHoDJG.d.ts → service-plugins-error-classes-DC9BuykL.d.ts} +29 -3
  22. package/build/internal/es/index.d.mts +2 -2
  23. package/build/internal/es/index.mjs +23 -0
  24. package/build/internal/es/index.mjs.map +1 -1
  25. package/build/internal/es/index.typings.d.mts +3 -2
  26. package/build/internal/es/index.typings.mjs +23 -0
  27. package/build/internal/es/index.typings.mjs.map +1 -1
  28. package/build/internal/es/{service-plugins-error-classes-B9LHoDJG.d.mts → service-plugins-error-classes-DC9BuykL.d.mts} +29 -3
  29. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../index.ts","../../../src/service-plugins-types.ts","../../../src/interfaces-ecom-v1-memberships-provider.public.ts","../../../src/interfaces-ecom-v1-memberships-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-ecom-v1-memberships-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","export interface ListEligibleMembershipsRequest {\n /**\n * The line items for which to list eligible memberships.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * The selected payment memberships and which line items they apply to.\n *\n * When not provided, your implementation is expected to return the default selection.\n * When provided, your implementation is expected to validate and return it.\n */\n selectedMemberships?: SelectedMemberships;\n}\n\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Catalog and item reference info. */\n catalogReference?: CatalogReference;\n /** Properties of the service. When relevant, contains information such as date and number of participants. */\n serviceProperties?: ServiceProperties;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in key:value pairs. Use this optional field to provide more specificity with item selection. The `options` field values differ depending on which catalog is providing the items.\n *\n * For products and variants from a Wix Stores catalog, learn more about [eCommerce integration](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface ServiceProperties {\n /**\n * Date and time the service is to be provided, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format.\n * For example, the start time of a class.\n */\n scheduledDate?: Date | null;\n /**\n * The number of people participating in the service. For example, the number of people attending a class or the number of people per hotel room.\n * @min 1\n * @max 10000\n */\n numberOfParticipants?: number | null;\n}\n\nexport interface SelectedMemberships {\n /**\n * Selected memberships.\n * @maxSize 300\n */\n memberships?: SelectedMembership[];\n}\n\nexport interface SelectedMembership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * IDs of the line items this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface ListEligibleMembershipsResponse {\n /**\n * List of memberships that are eligible for the given member and line items.\n * @maxSize 300\n */\n eligibleMemberships?: Membership[];\n /**\n * List of memberships owned by the member, but cannot be used due to the reason provided.\n * @maxSize 300\n */\n invalidMemberships?: InvalidMembership[];\n /**\n * List of selected memberships and which line items they apply to.\n * @maxSize 300\n */\n selectedMemberships?: SelectedMembership[];\n}\n\nexport interface Membership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Membership name. */\n name?: MembershipName;\n /**\n * Line item IDs this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n /** Total and remaining membership credits. */\n credits?: MembershipPaymentCredits;\n /** Membership expiration date. */\n expirationDate?: Date | null;\n /** Additional data about this membership. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface MembershipName {\n /**\n * Membership name.\n * @maxLength 100\n */\n original?: string;\n /**\n * Translated membership name. Defaults to `original` when not provided.\n * @maxLength 100\n */\n translated?: string | null;\n}\n\nexport interface MembershipPaymentCredits {\n /**\n * Membership's total amount of credits.\n * @min 1\n */\n total?: number;\n /** Membership's remaining amount of credits. */\n remaining?: number;\n}\n\nexport interface InvalidMembership {\n /** The membership that is invalid and cannot be used. */\n membership?: Membership;\n /**\n * Reason why this membership is invalid.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string;\n}\n\nexport interface MembershipInvalidSelectionErrors {\n /**\n * Error details for invalid memberships.\n * @maxSize 300\n */\n membershipInvalidSelectionErrors?: MembershipInvalidSelectionError[];\n}\n\nexport interface MembershipInvalidSelectionError\n extends MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n /**\n * Membership ID.\n * @format GUID\n */\n membershipId?: string;\n /** Error type. */\n errorType?: MembershipErrorType;\n}\n\n/** @oneof */\nexport interface MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n}\n\nexport enum MembershipErrorType {\n UNKNOWN = 'UNKNOWN',\n /** Membership not found. */\n MEMBERSHIP_NOT_FOUND = 'MEMBERSHIP_NOT_FOUND',\n /** The selection points to a line item ID that wasn't provided. */\n LINE_ITEM_NOT_FOUND = 'LINE_ITEM_NOT_FOUND',\n /** The membership cannot be used for the specific line items provided. */\n MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS = 'MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS',\n /** The membership can be used for each individual line item, but combining all of them is invalid. */\n MEMBERSHIP_SELECTION_INVALID = 'MEMBERSHIP_SELECTION_INVALID',\n}\n\nexport interface LineItemNotFoundInfo {\n /**\n * Line item IDs that were missing.\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemsInfo {\n /**\n * Line items that cannot be used with this membership, and the reason why.\n * @maxSize 300\n */\n lineItems?: MembershipCannotBeUsedForLineItemInfo[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemInfo {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n lineItemId?: string;\n /**\n * Reason why this line item cannot be used with this membership.\n * @maxLength 1000\n */\n reason?: string;\n}\n\nexport interface ChargeMembershipRequest {\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * Membership ID, as returned from the List Eligible Memberships call.\n * @minLength 1\n * @maxLength 100\n */\n membershipId: string;\n /**\n * Idempotency key to avoid duplicate charge.\n * The value will usually would be the same as `membershipId` + `orderId` + `rootCatalogItemId`.\n * @minLength 1\n * @maxLength 200\n */\n idempotencyKey: string;\n /**\n * Service properties.\n *\n * When relevant, this contains information such as date and number of participants.\n */\n serviceProperties?: ServiceProperties;\n /** Catalog and item reference info. */\n catalogReference: CatalogReference;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n /** Additional data about this charge. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface ChargeMembershipResponse {\n /**\n * The transaction ID for this charge.\n *\n * Use this ID to void the charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface MembershipCannotBeChargedError\n extends MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n /** Error type. */\n errorType?: MembershipCannotBeChargedType;\n}\n\n/** @oneof */\nexport interface MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n}\n\nexport enum MembershipCannotBeChargedType {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n OUT_OF_CREDITS = 'OUT_OF_CREDITS',\n /** Membership has not become active yet. */\n NOT_STARTED_YET = 'NOT_STARTED_YET',\n /** Membership has expired or ended. */\n ENDED = 'ENDED',\n /** Not applicable for multiple participants. */\n NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS = 'NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS',\n}\n\nexport interface OutOfCredits {\n /** Required amount of credits. */\n required?: number;\n /** Remaining amount of credits. */\n remaining?: number;\n}\n\nexport interface NotStartedYet {\n /** Start date of the membership. */\n membershipStartDate?: Date | null;\n}\n\nexport interface Ended {\n /** End date of the membership. */\n endDate?: Date | null;\n}\n\nexport interface MembershipAlreadyChargedError {\n /**\n * ID of the transaction that was already used for membership charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface GetMembershipVoidabilityRequest {\n /**\n * Transaction ID to check if it can be voided.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface GetMembershipVoidabilityResponse {\n /** Whether the membership charge can be voided. */\n voidable?: boolean;\n /**\n * Reason why the membership charge cannot be voided.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string | null;\n}\n\nexport interface VoidMembershipChargeRequest {\n /**\n * Transaction ID to void.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface VoidMembershipChargeResponse {}\n\nexport interface MembershipsSPIConfig {\n /**\n * The base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI.\n * For example, to call the Charge Membership endpoint at https://my-memberships.com/v1/charge-membership, the base URI you provide here is https://my-memberships.com/.\n * @format WEB_URL\n */\n deploymentUri?: string;\n /**\n * The app IDs of the catalogs your app supports.\n * @minSize 1\n * @maxSize 300\n * @format GUID\n */\n catalogAppDefIds?: 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\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 ListEligibleMembershipsRequest,\n ListEligibleMembershipsResponse,\n ChargeMembershipRequest,\n ChargeMembershipResponse,\n GetMembershipVoidabilityRequest,\n GetMembershipVoidabilityResponse,\n VoidMembershipChargeRequest,\n VoidMembershipChargeResponse,\n} from './service-plugins-types.js';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\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\nexport interface ListEligibleMembershipsEnvelope {\n request: ListEligibleMembershipsRequest;\n metadata: Context;\n}\n\nexport interface ChargeMembershipEnvelope {\n request: ChargeMembershipRequest;\n metadata: Context;\n}\n\nexport interface GetMembershipVoidabilityEnvelope {\n request: GetMembershipVoidabilityRequest;\n metadata: Context;\n}\n\nexport interface VoidMembershipChargeEnvelope {\n request: VoidMembershipChargeRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * This method retrieves eligible memberships from your app. */\n listEligibleMemberships(\n payload: ListEligibleMembershipsEnvelope\n ): ListEligibleMembershipsResponse | Promise<ListEligibleMembershipsResponse>;\n\n /**\n *\n * This method requests that a membership be charged by your app. */\n chargeMembership(\n payload: ChargeMembershipEnvelope\n ): ChargeMembershipResponse | Promise<ChargeMembershipResponse>;\n\n /**\n *\n * This method retrieves from your app whether a membership can be voided. */\n getMembershipVoidability(\n payload: GetMembershipVoidabilityEnvelope\n ):\n | GetMembershipVoidabilityResponse\n | Promise<GetMembershipVoidabilityResponse>;\n\n /**\n *\n * This method requests that a membership charge be voided by your app. */\n voidMembershipCharge(\n payload: VoidMembershipChargeEnvelope\n ): VoidMembershipChargeResponse | Promise<VoidMembershipChargeResponse>;\n}>('ECOM_MEMBERSHIPS', [\n {\n name: 'listEligibleMemberships',\n primaryHttpMappingPath: '/v1/list-eligible-memberships',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'eligibleMemberships.expirationDate' },\n { path: 'invalidMemberships.membership.expirationDate' },\n ],\n },\n ]);\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.lineItems.serviceProperties.scheduledDate' },\n { path: 'request.lineItems.serviceProperties.endDate' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeMembership',\n primaryHttpMappingPath: '/v1/charge-membership',\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: [\n { path: 'request.serviceProperties.scheduledDate' },\n { path: 'request.serviceProperties.endDate' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'getMembershipVoidability',\n primaryHttpMappingPath: '/v1/get-voidability',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'voidMembershipCharge',\n primaryHttpMappingPath: '/v1/void-membership-charge',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-ecom-v1-memberships-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-ecom-v1-memberships-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","import {\n MembershipInvalidSelectionErrors,\n MembershipCannotBeChargedError,\n MembershipAlreadyChargedError,\n} from './service-plugins-types.js';\n\n/**\n * The provided membership selection is invalid\n */\nexport class InvalidSelectionWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipInvalidSelectionErrors;\n\n constructor(data: MembershipInvalidSelectionErrors = {}) {\n super('InvalidSelection');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_SELECTION';\n this.name = 'InvalidSelection';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipInvalidSelectionErrors';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidSelection',\n applicationCode: 'INVALID_SELECTION',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, but does not apply for the provided item\n */\nexport class MembershipDoesNotApplyToItemWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('MembershipDoesNotApplyToItem');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM';\n this.name = 'MembershipDoesNotApplyToItem';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipDoesNotApplyToItem',\n applicationCode: 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, applied to the provided item but cannot be charged. For example because a limited membership doesn't have enough credits\n */\nexport class MembershipCannotBeUsedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipCannotBeChargedError;\n\n constructor(data: MembershipCannotBeChargedError = {}) {\n super('MembershipCannotBeUsed');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'MEMBERSHIP_CANNOT_BE_CHARGED';\n this.name = 'MembershipCannotBeUsed';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipCannotBeChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipCannotBeUsed',\n applicationCode: 'MEMBERSHIP_CANNOT_BE_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * This charge was already done, per the idempotency key of membershipId + orderId + rootCatalogItemId\n */\nexport class MembershipAlreadyChargedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipAlreadyChargedError;\n\n constructor(data: MembershipAlreadyChargedError = {}) {\n super('MembershipAlreadyCharged');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'MEMBERSHIP_ALREADY_CHARGED';\n this.name = 'MembershipAlreadyCharged';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipAlreadyChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipAlreadyCharged',\n applicationCode: 'MEMBERSHIP_ALREADY_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction not found\n */\nexport class TransactionNotFoundWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionNotFound');\n\n this.httpCode = 404;\n this.statusCode = 'NOT_FOUND';\n this.applicationCode = 'TRANSACTION_NOT_FOUND';\n this.name = 'TransactionNotFound';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionNotFound',\n applicationCode: 'TRANSACTION_NOT_FOUND',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction exists but cannot be voided\n */\nexport class TransactionCannotBeVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionCannotBeVoided');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'TRANSACTION_CANNOT_BE_VOIDED';\n this.name = 'TransactionCannotBeVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionCannotBeVoided',\n applicationCode: 'TRANSACTION_CANNOT_BE_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction was already voided\n */\nexport class TransactionAlreadyVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionAlreadyVoided');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'TRANSACTION_ALREADY_VOIDED';\n this.name = 'TransactionAlreadyVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionAlreadyVoided',\n applicationCode: 'TRANSACTION_ALREADY_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACuOO,IAAK,sBA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,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,4BA6BK,SAAS;AAMpB,IAAM,oCAAN,cAAgD,MAAM;AAAA,EAc3D,cAAc;AACZ,UAAM,2BAA2B;AAEjC,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,kCA6BK,SAAS;AAMpB,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAc1D,cAAc;AACZ,UAAM,0BAA0B;AAEhC,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,iCA6BK,SAAS;","names":["provideHandlers","MembershipErrorType","MembershipCannotBeChargedType","IdentityType","import_timestamp","provideHandlers"]}
1
+ {"version":3,"sources":["../../../index.ts","../../../src/service-plugins-types.ts","../../../src/interfaces-ecom-v1-memberships-provider.public.ts","../../../src/interfaces-ecom-v1-memberships-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-ecom-v1-memberships-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","export interface ListEligibleMembershipsRequest {\n /**\n * The line items for which to list eligible memberships.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * The selected payment memberships and which line items they apply to.\n *\n * When not provided, your implementation is expected to return the default selection.\n * When provided, your implementation is expected to validate and return it.\n */\n selectedMemberships?: SelectedMemberships;\n}\n\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Catalog and item reference info. */\n catalogReference?: CatalogReference;\n /** Properties of the service. When relevant, contains information such as date and number of participants. */\n serviceProperties?: ServiceProperties;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in key:value pairs. Use this optional field to provide more specificity with item selection. The `options` field values differ depending on which catalog is providing the items.\n *\n * For products and variants from a Wix Stores catalog, learn more about [eCommerce integration](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface ServiceProperties {\n /**\n * Date and time the service is to be provided, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format.\n * For example, the start time of a class.\n */\n scheduledDate?: Date | null;\n /**\n * The number of people participating in the service. For example, the number of people attending a class or the number of people per hotel room.\n * @min 1\n * @max 10000\n */\n numberOfParticipants?: number | null;\n}\n\nexport interface SelectedMemberships {\n /**\n * Selected memberships.\n * @maxSize 300\n */\n memberships?: SelectedMembership[];\n}\n\nexport interface SelectedMembership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * IDs of the line items this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface ListEligibleMembershipsResponse {\n /**\n * List of memberships that are eligible for the given member and line items.\n * @maxSize 300\n */\n eligibleMemberships?: Membership[];\n /**\n * List of memberships owned by the member, but cannot be used due to the reason provided.\n * @maxSize 300\n */\n invalidMemberships?: InvalidMembership[];\n /**\n * List of selected memberships and which line items they apply to.\n * @maxSize 300\n */\n selectedMemberships?: SelectedMembership[];\n}\n\nexport interface Membership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Membership name. */\n name?: MembershipName;\n /**\n * Line item IDs this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n /** Total and remaining membership credits. */\n credits?: MembershipPaymentCredits;\n /** Membership expiration date. */\n expirationDate?: Date | null;\n /** Additional data about this membership. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface MembershipName {\n /**\n * Membership name.\n * @maxLength 100\n */\n original?: string;\n /**\n * Translated membership name. Defaults to `original` when not provided.\n * @maxLength 100\n */\n translated?: string | null;\n}\n\nexport interface MembershipPaymentCredits {\n /**\n * Membership's initial value.\n * @min 1\n */\n total?: number;\n /** Membership's remaining value. */\n remaining?: number;\n}\n\nexport enum BalanceType {\n /** Balance is measured in discrete uses (e.g., sessions, visits). */\n PUNCH_CARD = 'PUNCH_CARD',\n /** Balance is measured in a currency-like value (e.g., points). */\n CREDIT = 'CREDIT',\n}\n\nexport interface InvalidMembership {\n /** The membership that is invalid and cannot be used. */\n membership?: Membership;\n /**\n * Reason why this membership is invalid.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string;\n}\n\nexport interface MembershipInvalidSelectionErrors {\n /**\n * Error details for invalid memberships.\n * @maxSize 300\n */\n membershipInvalidSelectionErrors?: MembershipInvalidSelectionError[];\n}\n\nexport interface MembershipInvalidSelectionError\n extends MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n /**\n * Membership ID.\n * @format GUID\n */\n membershipId?: string;\n /** Error type. */\n errorType?: MembershipErrorType;\n}\n\n/** @oneof */\nexport interface MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n}\n\nexport enum MembershipErrorType {\n UNKNOWN = 'UNKNOWN',\n /** Membership not found. */\n MEMBERSHIP_NOT_FOUND = 'MEMBERSHIP_NOT_FOUND',\n /** The selection points to a line item ID that wasn't provided. */\n LINE_ITEM_NOT_FOUND = 'LINE_ITEM_NOT_FOUND',\n /** The membership cannot be used for the specific line items provided. */\n MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS = 'MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS',\n /** The membership can be used for each individual line item, but combining all of them is invalid. */\n MEMBERSHIP_SELECTION_INVALID = 'MEMBERSHIP_SELECTION_INVALID',\n}\n\nexport interface LineItemNotFoundInfo {\n /**\n * Line item IDs that were missing.\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemsInfo {\n /**\n * Line items that cannot be used with this membership, and the reason why.\n * @maxSize 300\n */\n lineItems?: MembershipCannotBeUsedForLineItemInfo[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemInfo {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n lineItemId?: string;\n /**\n * Reason why this line item cannot be used with this membership.\n * @maxLength 1000\n */\n reason?: string;\n}\n\nexport interface ChargeMembershipRequest {\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * Membership ID, as returned from the List Eligible Memberships call.\n * @minLength 1\n * @maxLength 100\n */\n membershipId: string;\n /**\n * Idempotency key to avoid duplicate charge.\n * The value will usually would be the same as `membershipId` + `orderId` + `rootCatalogItemId`.\n * @minLength 1\n * @maxLength 200\n */\n idempotencyKey: string;\n /**\n * Service properties.\n *\n * When relevant, this contains information such as date and number of participants.\n */\n serviceProperties?: ServiceProperties;\n /** Catalog and item reference info. */\n catalogReference: CatalogReference;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n /** Additional data about this charge. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface ChargeMembershipResponse {\n /**\n * The transaction ID for this charge.\n *\n * Use this ID to void the charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface MembershipCannotBeChargedError\n extends MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n /** Error type. */\n errorType?: MembershipCannotBeChargedType;\n}\n\n/** @oneof */\nexport interface MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n}\n\nexport enum MembershipCannotBeChargedType {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n OUT_OF_CREDITS = 'OUT_OF_CREDITS',\n /** Membership has not become active yet. */\n NOT_STARTED_YET = 'NOT_STARTED_YET',\n /** Membership has expired or ended. */\n ENDED = 'ENDED',\n /** Not applicable for multiple participants. */\n NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS = 'NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS',\n}\n\nexport interface OutOfCredits {\n /** Required amount of credits. */\n required?: number;\n /** Remaining amount of credits. */\n remaining?: number;\n}\n\nexport interface NotStartedYet {\n /** Start date of the membership. */\n membershipStartDate?: Date | null;\n}\n\nexport interface Ended {\n /** End date of the membership. */\n endDate?: Date | null;\n}\n\nexport interface MembershipAlreadyChargedError {\n /**\n * ID of the transaction that was already used for membership charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface GetMembershipVoidabilityRequest {\n /**\n * Transaction ID to check if it can be voided.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface GetMembershipVoidabilityResponse {\n /** Whether the membership charge can be voided. */\n voidable?: boolean;\n /**\n * Reason why the membership charge cannot be voided.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string | null;\n}\n\nexport interface VoidMembershipChargeRequest {\n /**\n * Transaction ID to void.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface VoidMembershipChargeResponse {}\n\nexport interface MembershipsSPIConfig {\n /**\n * The base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI.\n * For example, to call the Charge Membership endpoint at https://my-memberships.com/v1/charge-membership, the base URI you provide here is https://my-memberships.com/.\n * @format WEB_URL\n */\n deploymentUri?: string;\n /**\n * The app IDs of the catalogs your app supports.\n * @minSize 1\n * @maxSize 300\n * @format GUID\n */\n catalogAppDefIds?: 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\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 ListEligibleMembershipsRequest,\n ListEligibleMembershipsResponse,\n ChargeMembershipRequest,\n ChargeMembershipResponse,\n GetMembershipVoidabilityRequest,\n GetMembershipVoidabilityResponse,\n VoidMembershipChargeRequest,\n VoidMembershipChargeResponse,\n} from './service-plugins-types.js';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\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\nexport interface ListEligibleMembershipsEnvelope {\n request: ListEligibleMembershipsRequest;\n metadata: Context;\n}\n\nexport interface ChargeMembershipEnvelope {\n request: ChargeMembershipRequest;\n metadata: Context;\n}\n\nexport interface GetMembershipVoidabilityEnvelope {\n request: GetMembershipVoidabilityRequest;\n metadata: Context;\n}\n\nexport interface VoidMembershipChargeEnvelope {\n request: VoidMembershipChargeRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * This method retrieves eligible memberships from your app. */\n listEligibleMemberships(\n payload: ListEligibleMembershipsEnvelope\n ): ListEligibleMembershipsResponse | Promise<ListEligibleMembershipsResponse>;\n\n /**\n *\n * This method requests that a membership be charged by your app. */\n chargeMembership(\n payload: ChargeMembershipEnvelope\n ): ChargeMembershipResponse | Promise<ChargeMembershipResponse>;\n\n /**\n *\n * This method retrieves from your app whether a membership can be voided. */\n getMembershipVoidability(\n payload: GetMembershipVoidabilityEnvelope\n ):\n | GetMembershipVoidabilityResponse\n | Promise<GetMembershipVoidabilityResponse>;\n\n /**\n *\n * This method requests that a membership charge be voided by your app. */\n voidMembershipCharge(\n payload: VoidMembershipChargeEnvelope\n ): VoidMembershipChargeResponse | Promise<VoidMembershipChargeResponse>;\n}>('ECOM_MEMBERSHIPS', [\n {\n name: 'listEligibleMemberships',\n primaryHttpMappingPath: '/v1/list-eligible-memberships',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'eligibleMemberships.expirationDate' },\n { path: 'invalidMemberships.membership.expirationDate' },\n ],\n },\n ]);\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.lineItems.serviceProperties.scheduledDate' },\n { path: 'request.lineItems.serviceProperties.endDate' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeMembership',\n primaryHttpMappingPath: '/v1/charge-membership',\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: [\n { path: 'request.serviceProperties.scheduledDate' },\n { path: 'request.serviceProperties.endDate' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'getMembershipVoidability',\n primaryHttpMappingPath: '/v1/get-voidability',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'voidMembershipCharge',\n primaryHttpMappingPath: '/v1/void-membership-charge',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-ecom-v1-memberships-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-ecom-v1-memberships-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","import {\n MembershipInvalidSelectionErrors,\n MembershipCannotBeChargedError,\n MembershipAlreadyChargedError,\n} from './service-plugins-types.js';\n\n/**\n * The provided membership selection is invalid\n */\nexport class InvalidSelectionWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipInvalidSelectionErrors;\n\n constructor(data: MembershipInvalidSelectionErrors = {}) {\n super('InvalidSelection');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_SELECTION';\n this.name = 'InvalidSelection';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipInvalidSelectionErrors';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidSelection',\n applicationCode: 'INVALID_SELECTION',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The selected memberships do not have enough balance to cover the line items.\n */\nexport class InsufficientBalanceWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InsufficientBalance');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'INSUFFICIENT_BALANCE';\n this.name = 'InsufficientBalance';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InsufficientBalance',\n applicationCode: 'INSUFFICIENT_BALANCE',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, but does not apply for the provided item\n */\nexport class MembershipDoesNotApplyToItemWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('MembershipDoesNotApplyToItem');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM';\n this.name = 'MembershipDoesNotApplyToItem';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipDoesNotApplyToItem',\n applicationCode: 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, applied to the provided item but cannot be charged. For example because a limited membership doesn't have enough credits\n */\nexport class MembershipCannotBeUsedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipCannotBeChargedError;\n\n constructor(data: MembershipCannotBeChargedError = {}) {\n super('MembershipCannotBeUsed');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'MEMBERSHIP_CANNOT_BE_CHARGED';\n this.name = 'MembershipCannotBeUsed';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipCannotBeChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipCannotBeUsed',\n applicationCode: 'MEMBERSHIP_CANNOT_BE_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * This charge was already done, per the idempotency key of membershipId + orderId + rootCatalogItemId\n */\nexport class MembershipAlreadyChargedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipAlreadyChargedError;\n\n constructor(data: MembershipAlreadyChargedError = {}) {\n super('MembershipAlreadyCharged');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'MEMBERSHIP_ALREADY_CHARGED';\n this.name = 'MembershipAlreadyCharged';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipAlreadyChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipAlreadyCharged',\n applicationCode: 'MEMBERSHIP_ALREADY_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction not found\n */\nexport class TransactionNotFoundWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionNotFound');\n\n this.httpCode = 404;\n this.statusCode = 'NOT_FOUND';\n this.applicationCode = 'TRANSACTION_NOT_FOUND';\n this.name = 'TransactionNotFound';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionNotFound',\n applicationCode: 'TRANSACTION_NOT_FOUND',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction exists but cannot be voided\n */\nexport class TransactionCannotBeVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionCannotBeVoided');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'TRANSACTION_CANNOT_BE_VOIDED';\n this.name = 'TransactionCannotBeVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionCannotBeVoided',\n applicationCode: 'TRANSACTION_CANNOT_BE_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction was already voided\n */\nexport class TransactionAlreadyVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionAlreadyVoided');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'TRANSACTION_ALREADY_VOIDED';\n this.name = 'TransactionAlreadyVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionAlreadyVoided',\n applicationCode: 'TRANSACTION_ALREADY_VOIDED',\n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,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,iCA6BK,SAAS;","names":["provideHandlers","BalanceType","MembershipErrorType","MembershipCannotBeChargedType","IdentityType","import_timestamp","provideHandlers"]}
@@ -1,10 +1,11 @@
1
- import { P as ListEligibleMembershipsEnvelope, d as ListEligibleMembershipsResponse, Q as ChargeMembershipEnvelope, o as ChargeMembershipResponse, R as GetMembershipVoidabilityEnvelope, u as GetMembershipVoidabilityResponse, U as VoidMembershipChargeEnvelope, v as VoidMembershipChargeResponse } from './service-plugins-error-classes-B9LHoDJG.js';
2
- export { C as CatalogReference, n as ChargeMembershipRequest, x as Context, E as Ended, G as GetMembershipVoidabilityRequest, z as IdentificationData, A as IdentificationDataIdOneOf, y as IdentityType, I as InvalidMembership, B as InvalidSelectionWixError, a as LineItem, k as LineItemNotFoundInfo, L as ListEligibleMembershipsRequest, M as Membership, t as MembershipAlreadyChargedError, H as MembershipAlreadyChargedWixError, q as MembershipCannotBeChargedError, r as MembershipCannotBeChargedErrorErrorDataOneOf, s as MembershipCannotBeChargedType, m as MembershipCannotBeUsedForLineItemInfo, l as MembershipCannotBeUsedForLineItemsInfo, F as MembershipCannotBeUsedWixError, D as MembershipDoesNotApplyToItemWixError, j as MembershipErrorType, h as MembershipInvalidSelectionError, i as MembershipInvalidSelectionErrorErrorDataOneOf, g as MembershipInvalidSelectionErrors, e as MembershipName, f as MembershipPaymentCredits, w as MembershipsSPIConfig, N as NotStartedYet, O as OutOfCredits, c as SelectedMembership, b as SelectedMemberships, S as ServiceProperties, K as TransactionAlreadyVoidedWixError, J as TransactionCannotBeVoidedWixError, T as TransactionNotFoundWixError, V as VoidMembershipChargeRequest } from './service-plugins-error-classes-B9LHoDJG.js';
1
+ import { R as ListEligibleMembershipsEnvelope, d as ListEligibleMembershipsResponse, U as ChargeMembershipEnvelope, o as ChargeMembershipResponse, W as GetMembershipVoidabilityEnvelope, u as GetMembershipVoidabilityResponse, X as VoidMembershipChargeEnvelope, v as VoidMembershipChargeResponse } from './service-plugins-error-classes-DC9BuykL.js';
2
+ export { B as BalanceType, C as CatalogReference, n as ChargeMembershipRequest, x as Context, E as Ended, G as GetMembershipVoidabilityRequest, z as IdentificationData, A as IdentificationDataIdOneOf, y as IdentityType, F as InsufficientBalanceWixError, I as InvalidMembership, D as InvalidSelectionWixError, a as LineItem, k as LineItemNotFoundInfo, L as ListEligibleMembershipsRequest, M as Membership, t as MembershipAlreadyChargedError, K as MembershipAlreadyChargedWixError, q as MembershipCannotBeChargedError, r as MembershipCannotBeChargedErrorErrorDataOneOf, s as MembershipCannotBeChargedType, m as MembershipCannotBeUsedForLineItemInfo, l as MembershipCannotBeUsedForLineItemsInfo, J as MembershipCannotBeUsedWixError, H as MembershipDoesNotApplyToItemWixError, j as MembershipErrorType, h as MembershipInvalidSelectionError, i as MembershipInvalidSelectionErrorErrorDataOneOf, g as MembershipInvalidSelectionErrors, e as MembershipName, f as MembershipPaymentCredits, w as MembershipsSPIConfig, N as NotStartedYet, O as OutOfCredits, c as SelectedMembership, b as SelectedMemberships, S as ServiceProperties, Q as TransactionAlreadyVoidedWixError, P as TransactionCannotBeVoidedWixError, T as TransactionNotFoundWixError, V as VoidMembershipChargeRequest } from './service-plugins-error-classes-DC9BuykL.js';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
6
6
  * This method retrieves eligible memberships from your app.
7
7
  * @throws InvalidSelectionWixError
8
+ * @throws InsufficientBalanceWixError
8
9
  */
9
10
  declare function listEligibleMemberships(payload: ListEligibleMembershipsEnvelope): ListEligibleMembershipsResponse | Promise<ListEligibleMembershipsResponse>;
10
11
  /**
@@ -20,7 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // index.typings.ts
21
21
  var index_typings_exports = {};
22
22
  __export(index_typings_exports, {
23
+ BalanceType: () => BalanceType,
23
24
  IdentityType: () => IdentityType,
25
+ InsufficientBalanceWixError: () => InsufficientBalanceWixError,
24
26
  InvalidSelectionWixError: () => InvalidSelectionWixError,
25
27
  MembershipAlreadyChargedWixError: () => MembershipAlreadyChargedWixError,
26
28
  MembershipCannotBeChargedType: () => MembershipCannotBeChargedType,
@@ -52,6 +54,22 @@ var InvalidSelectionWixError = class extends Error {
52
54
  };
53
55
  /** @hidden */
54
56
  InvalidSelectionWixError.__type = "wix_spi_error";
57
+ var InsufficientBalanceWixError = class extends Error {
58
+ constructor() {
59
+ super("InsufficientBalance");
60
+ this.httpCode = 428;
61
+ this.statusCode = "FAILED_PRECONDITION";
62
+ this.applicationCode = "INSUFFICIENT_BALANCE";
63
+ this.name = "InsufficientBalance";
64
+ this.errorType = "SPI";
65
+ this.spiErrorData = {
66
+ name: "InsufficientBalance",
67
+ applicationCode: "INSUFFICIENT_BALANCE"
68
+ };
69
+ }
70
+ };
71
+ /** @hidden */
72
+ InsufficientBalanceWixError.__type = "wix_spi_error";
55
73
  var MembershipDoesNotApplyToItemWixError = class extends Error {
56
74
  constructor() {
57
75
  super("MembershipDoesNotApplyToItem");
@@ -154,6 +172,11 @@ var TransactionAlreadyVoidedWixError = class extends Error {
154
172
  TransactionAlreadyVoidedWixError.__type = "wix_spi_error";
155
173
 
156
174
  // src/service-plugins-types.ts
175
+ var BalanceType = /* @__PURE__ */ ((BalanceType2) => {
176
+ BalanceType2["PUNCH_CARD"] = "PUNCH_CARD";
177
+ BalanceType2["CREDIT"] = "CREDIT";
178
+ return BalanceType2;
179
+ })(BalanceType || {});
157
180
  var MembershipErrorType = /* @__PURE__ */ ((MembershipErrorType2) => {
158
181
  MembershipErrorType2["UNKNOWN"] = "UNKNOWN";
159
182
  MembershipErrorType2["MEMBERSHIP_NOT_FOUND"] = "MEMBERSHIP_NOT_FOUND";
@@ -179,7 +202,9 @@ var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
179
202
  })(IdentityType || {});
180
203
  // Annotate the CommonJS export names for ESM import in node:
181
204
  0 && (module.exports = {
205
+ BalanceType,
182
206
  IdentityType,
207
+ InsufficientBalanceWixError,
183
208
  InvalidSelectionWixError,
184
209
  MembershipAlreadyChargedWixError,
185
210
  MembershipCannotBeChargedType,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../index.typings.ts","../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["import {\n ListEligibleMembershipsResponse,\n ChargeMembershipResponse,\n GetMembershipVoidabilityResponse,\n VoidMembershipChargeResponse,\n} from './src/service-plugins-types.js';\nimport {\n ListEligibleMembershipsEnvelope,\n ChargeMembershipEnvelope,\n GetMembershipVoidabilityEnvelope,\n VoidMembershipChargeEnvelope,\n} from './src/interfaces-ecom-v1-memberships-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport {\n ListEligibleMembershipsEnvelope,\n ChargeMembershipEnvelope,\n GetMembershipVoidabilityEnvelope,\n VoidMembershipChargeEnvelope,\n};\n\n/**\n * This method retrieves eligible memberships from your app.\n * @throws InvalidSelectionWixError\n */\nexport declare function listEligibleMemberships(\n payload: ListEligibleMembershipsEnvelope\n): ListEligibleMembershipsResponse | Promise<ListEligibleMembershipsResponse>;\n/**\n * This method requests that a membership be charged by your app.\n * @throws MembershipDoesNotApplyToItemWixError\n * @throws MembershipCannotBeUsedWixError\n * @throws MembershipAlreadyChargedWixError\n */\nexport declare function chargeMembership(\n payload: ChargeMembershipEnvelope\n): ChargeMembershipResponse | Promise<ChargeMembershipResponse>;\n/**\n * This method retrieves from your app whether a membership can be voided.\n * @throws TransactionNotFoundWixError\n */\nexport declare function getMembershipVoidability(\n payload: GetMembershipVoidabilityEnvelope\n): GetMembershipVoidabilityResponse | Promise<GetMembershipVoidabilityResponse>;\n/**\n * This method requests that a membership charge be voided by your app.\n * @throws TransactionNotFoundWixError\n * @throws TransactionCannotBeVoidedWixError\n * @throws TransactionAlreadyVoidedWixError\n */\nexport declare function voidMembershipCharge(\n payload: VoidMembershipChargeEnvelope\n): VoidMembershipChargeResponse | Promise<VoidMembershipChargeResponse>;\n","import {\n MembershipInvalidSelectionErrors,\n MembershipCannotBeChargedError,\n MembershipAlreadyChargedError,\n} from './service-plugins-types.js';\n\n/**\n * The provided membership selection is invalid\n */\nexport class InvalidSelectionWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipInvalidSelectionErrors;\n\n constructor(data: MembershipInvalidSelectionErrors = {}) {\n super('InvalidSelection');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_SELECTION';\n this.name = 'InvalidSelection';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipInvalidSelectionErrors';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidSelection',\n applicationCode: 'INVALID_SELECTION',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, but does not apply for the provided item\n */\nexport class MembershipDoesNotApplyToItemWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('MembershipDoesNotApplyToItem');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM';\n this.name = 'MembershipDoesNotApplyToItem';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipDoesNotApplyToItem',\n applicationCode: 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, applied to the provided item but cannot be charged. For example because a limited membership doesn't have enough credits\n */\nexport class MembershipCannotBeUsedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipCannotBeChargedError;\n\n constructor(data: MembershipCannotBeChargedError = {}) {\n super('MembershipCannotBeUsed');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'MEMBERSHIP_CANNOT_BE_CHARGED';\n this.name = 'MembershipCannotBeUsed';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipCannotBeChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipCannotBeUsed',\n applicationCode: 'MEMBERSHIP_CANNOT_BE_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * This charge was already done, per the idempotency key of membershipId + orderId + rootCatalogItemId\n */\nexport class MembershipAlreadyChargedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipAlreadyChargedError;\n\n constructor(data: MembershipAlreadyChargedError = {}) {\n super('MembershipAlreadyCharged');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'MEMBERSHIP_ALREADY_CHARGED';\n this.name = 'MembershipAlreadyCharged';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipAlreadyChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipAlreadyCharged',\n applicationCode: 'MEMBERSHIP_ALREADY_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction not found\n */\nexport class TransactionNotFoundWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionNotFound');\n\n this.httpCode = 404;\n this.statusCode = 'NOT_FOUND';\n this.applicationCode = 'TRANSACTION_NOT_FOUND';\n this.name = 'TransactionNotFound';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionNotFound',\n applicationCode: 'TRANSACTION_NOT_FOUND',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction exists but cannot be voided\n */\nexport class TransactionCannotBeVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionCannotBeVoided');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'TRANSACTION_CANNOT_BE_VOIDED';\n this.name = 'TransactionCannotBeVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionCannotBeVoided',\n applicationCode: 'TRANSACTION_CANNOT_BE_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction was already voided\n */\nexport class TransactionAlreadyVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionAlreadyVoided');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'TRANSACTION_ALREADY_VOIDED';\n this.name = 'TransactionAlreadyVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionAlreadyVoided',\n applicationCode: 'TRANSACTION_ALREADY_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","export interface ListEligibleMembershipsRequest {\n /**\n * The line items for which to list eligible memberships.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * The selected payment memberships and which line items they apply to.\n *\n * When not provided, your implementation is expected to return the default selection.\n * When provided, your implementation is expected to validate and return it.\n */\n selectedMemberships?: SelectedMemberships;\n}\n\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Catalog and item reference info. */\n catalogReference?: CatalogReference;\n /** Properties of the service. When relevant, contains information such as date and number of participants. */\n serviceProperties?: ServiceProperties;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in key:value pairs. Use this optional field to provide more specificity with item selection. The `options` field values differ depending on which catalog is providing the items.\n *\n * For products and variants from a Wix Stores catalog, learn more about [eCommerce integration](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface ServiceProperties {\n /**\n * Date and time the service is to be provided, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format.\n * For example, the start time of a class.\n */\n scheduledDate?: Date | null;\n /**\n * The number of people participating in the service. For example, the number of people attending a class or the number of people per hotel room.\n * @min 1\n * @max 10000\n */\n numberOfParticipants?: number | null;\n}\n\nexport interface SelectedMemberships {\n /**\n * Selected memberships.\n * @maxSize 300\n */\n memberships?: SelectedMembership[];\n}\n\nexport interface SelectedMembership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * IDs of the line items this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface ListEligibleMembershipsResponse {\n /**\n * List of memberships that are eligible for the given member and line items.\n * @maxSize 300\n */\n eligibleMemberships?: Membership[];\n /**\n * List of memberships owned by the member, but cannot be used due to the reason provided.\n * @maxSize 300\n */\n invalidMemberships?: InvalidMembership[];\n /**\n * List of selected memberships and which line items they apply to.\n * @maxSize 300\n */\n selectedMemberships?: SelectedMembership[];\n}\n\nexport interface Membership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Membership name. */\n name?: MembershipName;\n /**\n * Line item IDs this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n /** Total and remaining membership credits. */\n credits?: MembershipPaymentCredits;\n /** Membership expiration date. */\n expirationDate?: Date | null;\n /** Additional data about this membership. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface MembershipName {\n /**\n * Membership name.\n * @maxLength 100\n */\n original?: string;\n /**\n * Translated membership name. Defaults to `original` when not provided.\n * @maxLength 100\n */\n translated?: string | null;\n}\n\nexport interface MembershipPaymentCredits {\n /**\n * Membership's total amount of credits.\n * @min 1\n */\n total?: number;\n /** Membership's remaining amount of credits. */\n remaining?: number;\n}\n\nexport interface InvalidMembership {\n /** The membership that is invalid and cannot be used. */\n membership?: Membership;\n /**\n * Reason why this membership is invalid.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string;\n}\n\nexport interface MembershipInvalidSelectionErrors {\n /**\n * Error details for invalid memberships.\n * @maxSize 300\n */\n membershipInvalidSelectionErrors?: MembershipInvalidSelectionError[];\n}\n\nexport interface MembershipInvalidSelectionError\n extends MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n /**\n * Membership ID.\n * @format GUID\n */\n membershipId?: string;\n /** Error type. */\n errorType?: MembershipErrorType;\n}\n\n/** @oneof */\nexport interface MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n}\n\nexport enum MembershipErrorType {\n UNKNOWN = 'UNKNOWN',\n /** Membership not found. */\n MEMBERSHIP_NOT_FOUND = 'MEMBERSHIP_NOT_FOUND',\n /** The selection points to a line item ID that wasn't provided. */\n LINE_ITEM_NOT_FOUND = 'LINE_ITEM_NOT_FOUND',\n /** The membership cannot be used for the specific line items provided. */\n MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS = 'MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS',\n /** The membership can be used for each individual line item, but combining all of them is invalid. */\n MEMBERSHIP_SELECTION_INVALID = 'MEMBERSHIP_SELECTION_INVALID',\n}\n\nexport interface LineItemNotFoundInfo {\n /**\n * Line item IDs that were missing.\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemsInfo {\n /**\n * Line items that cannot be used with this membership, and the reason why.\n * @maxSize 300\n */\n lineItems?: MembershipCannotBeUsedForLineItemInfo[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemInfo {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n lineItemId?: string;\n /**\n * Reason why this line item cannot be used with this membership.\n * @maxLength 1000\n */\n reason?: string;\n}\n\nexport interface ChargeMembershipRequest {\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * Membership ID, as returned from the List Eligible Memberships call.\n * @minLength 1\n * @maxLength 100\n */\n membershipId: string;\n /**\n * Idempotency key to avoid duplicate charge.\n * The value will usually would be the same as `membershipId` + `orderId` + `rootCatalogItemId`.\n * @minLength 1\n * @maxLength 200\n */\n idempotencyKey: string;\n /**\n * Service properties.\n *\n * When relevant, this contains information such as date and number of participants.\n */\n serviceProperties?: ServiceProperties;\n /** Catalog and item reference info. */\n catalogReference: CatalogReference;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n /** Additional data about this charge. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface ChargeMembershipResponse {\n /**\n * The transaction ID for this charge.\n *\n * Use this ID to void the charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface MembershipCannotBeChargedError\n extends MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n /** Error type. */\n errorType?: MembershipCannotBeChargedType;\n}\n\n/** @oneof */\nexport interface MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n}\n\nexport enum MembershipCannotBeChargedType {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n OUT_OF_CREDITS = 'OUT_OF_CREDITS',\n /** Membership has not become active yet. */\n NOT_STARTED_YET = 'NOT_STARTED_YET',\n /** Membership has expired or ended. */\n ENDED = 'ENDED',\n /** Not applicable for multiple participants. */\n NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS = 'NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS',\n}\n\nexport interface OutOfCredits {\n /** Required amount of credits. */\n required?: number;\n /** Remaining amount of credits. */\n remaining?: number;\n}\n\nexport interface NotStartedYet {\n /** Start date of the membership. */\n membershipStartDate?: Date | null;\n}\n\nexport interface Ended {\n /** End date of the membership. */\n endDate?: Date | null;\n}\n\nexport interface MembershipAlreadyChargedError {\n /**\n * ID of the transaction that was already used for membership charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface GetMembershipVoidabilityRequest {\n /**\n * Transaction ID to check if it can be voided.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface GetMembershipVoidabilityResponse {\n /** Whether the membership charge can be voided. */\n voidable?: boolean;\n /**\n * Reason why the membership charge cannot be voided.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string | null;\n}\n\nexport interface VoidMembershipChargeRequest {\n /**\n * Transaction ID to void.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface VoidMembershipChargeResponse {}\n\nexport interface MembershipsSPIConfig {\n /**\n * The base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI.\n * For example, to call the Charge Membership endpoint at https://my-memberships.com/v1/charge-membership, the base URI you provide here is https://my-memberships.com/.\n * @format WEB_URL\n */\n deploymentUri?: string;\n /**\n * The app IDs of the catalogs your app supports.\n * @minSize 1\n * @maxSize 300\n * @format GUID\n */\n catalogAppDefIds?: 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\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAkBlD,YAAY,OAAyC,CAAC,GAAG;AACvD,UAAM,kBAAkB;AAExB,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,kBACH;AACF,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAEA,SAAK,OAAO;AAAA,EACd;AAIF;AAAA;AAtCa,yBAqCK,SAAS;AAMpB,IAAM,uCAAN,cAAmD,MAAM;AAAA,EAc9D,cAAc;AACZ,UAAM,8BAA8B;AAEpC,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAA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MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,kCA6BK,SAAS;AAMpB,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAc1D,cAAc;AACZ,UAAM,0BAA0B;AAEhC,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,iCA6BK,SAAS;;;ACzCpB,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,aAAU;AAEV,EAAAA,qBAAA,0BAAuB;AAEvB,EAAAA,qBAAA,yBAAsB;AAEtB,EAAAA,qBAAA,8CAA2C;AAE3C,EAAAA,qBAAA,kCAA+B;AATrB,SAAAA;AAAA,GAAA;AAwHL,IAAK,gCAAL,kBAAKC,mCAAL;AAEL,EAAAA,+BAAA,oBAAiB;AAEjB,EAAAA,+BAAA,qBAAkB;AAElB,EAAAA,+BAAA,WAAQ;AAER,EAAAA,+BAAA,8CAA2C;AARjC,SAAAA;AAAA,GAAA;AAoHL,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;","names":["MembershipErrorType","MembershipCannotBeChargedType","IdentityType"]}
1
+ {"version":3,"sources":["../../../index.typings.ts","../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["import {\n ListEligibleMembershipsResponse,\n ChargeMembershipResponse,\n GetMembershipVoidabilityResponse,\n VoidMembershipChargeResponse,\n} from './src/service-plugins-types.js';\nimport {\n ListEligibleMembershipsEnvelope,\n ChargeMembershipEnvelope,\n GetMembershipVoidabilityEnvelope,\n VoidMembershipChargeEnvelope,\n} from './src/interfaces-ecom-v1-memberships-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport {\n ListEligibleMembershipsEnvelope,\n ChargeMembershipEnvelope,\n GetMembershipVoidabilityEnvelope,\n VoidMembershipChargeEnvelope,\n};\n\n/**\n * This method retrieves eligible memberships from your app.\n * @throws InvalidSelectionWixError\n * @throws InsufficientBalanceWixError\n */\nexport declare function listEligibleMemberships(\n payload: ListEligibleMembershipsEnvelope\n): ListEligibleMembershipsResponse | Promise<ListEligibleMembershipsResponse>;\n/**\n * This method requests that a membership be charged by your app.\n * @throws MembershipDoesNotApplyToItemWixError\n * @throws MembershipCannotBeUsedWixError\n * @throws MembershipAlreadyChargedWixError\n */\nexport declare function chargeMembership(\n payload: ChargeMembershipEnvelope\n): ChargeMembershipResponse | Promise<ChargeMembershipResponse>;\n/**\n * This method retrieves from your app whether a membership can be voided.\n * @throws TransactionNotFoundWixError\n */\nexport declare function getMembershipVoidability(\n payload: GetMembershipVoidabilityEnvelope\n): GetMembershipVoidabilityResponse | Promise<GetMembershipVoidabilityResponse>;\n/**\n * This method requests that a membership charge be voided by your app.\n * @throws TransactionNotFoundWixError\n * @throws TransactionCannotBeVoidedWixError\n * @throws TransactionAlreadyVoidedWixError\n */\nexport declare function voidMembershipCharge(\n payload: VoidMembershipChargeEnvelope\n): VoidMembershipChargeResponse | Promise<VoidMembershipChargeResponse>;\n","import {\n MembershipInvalidSelectionErrors,\n MembershipCannotBeChargedError,\n MembershipAlreadyChargedError,\n} from './service-plugins-types.js';\n\n/**\n * The provided membership selection is invalid\n */\nexport class InvalidSelectionWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipInvalidSelectionErrors;\n\n constructor(data: MembershipInvalidSelectionErrors = {}) {\n super('InvalidSelection');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_SELECTION';\n this.name = 'InvalidSelection';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipInvalidSelectionErrors';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidSelection',\n applicationCode: 'INVALID_SELECTION',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The selected memberships do not have enough balance to cover the line items.\n */\nexport class InsufficientBalanceWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InsufficientBalance');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'INSUFFICIENT_BALANCE';\n this.name = 'InsufficientBalance';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InsufficientBalance',\n applicationCode: 'INSUFFICIENT_BALANCE',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, but does not apply for the provided item\n */\nexport class MembershipDoesNotApplyToItemWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('MembershipDoesNotApplyToItem');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM';\n this.name = 'MembershipDoesNotApplyToItem';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipDoesNotApplyToItem',\n applicationCode: 'MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * The membership was found, applied to the provided item but cannot be charged. For example because a limited membership doesn't have enough credits\n */\nexport class MembershipCannotBeUsedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipCannotBeChargedError;\n\n constructor(data: MembershipCannotBeChargedError = {}) {\n super('MembershipCannotBeUsed');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'MEMBERSHIP_CANNOT_BE_CHARGED';\n this.name = 'MembershipCannotBeUsed';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipCannotBeChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipCannotBeUsed',\n applicationCode: 'MEMBERSHIP_CANNOT_BE_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * This charge was already done, per the idempotency key of membershipId + orderId + rootCatalogItemId\n */\nexport class MembershipAlreadyChargedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorSchemaName: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n data: MembershipAlreadyChargedError;\n\n constructor(data: MembershipAlreadyChargedError = {}) {\n super('MembershipAlreadyCharged');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'MEMBERSHIP_ALREADY_CHARGED';\n this.name = 'MembershipAlreadyCharged';\n this.errorSchemaName =\n 'com.wix.ecom.memberships_spi.v1.MembershipAlreadyChargedError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'MembershipAlreadyCharged',\n applicationCode: 'MEMBERSHIP_ALREADY_CHARGED',\n };\n\n this.data = data;\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction not found\n */\nexport class TransactionNotFoundWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionNotFound');\n\n this.httpCode = 404;\n this.statusCode = 'NOT_FOUND';\n this.applicationCode = 'TRANSACTION_NOT_FOUND';\n this.name = 'TransactionNotFound';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionNotFound',\n applicationCode: 'TRANSACTION_NOT_FOUND',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction exists but cannot be voided\n */\nexport class TransactionCannotBeVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionCannotBeVoided');\n\n this.httpCode = 428;\n this.statusCode = 'FAILED_PRECONDITION';\n this.applicationCode = 'TRANSACTION_CANNOT_BE_VOIDED';\n this.name = 'TransactionCannotBeVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionCannotBeVoided',\n applicationCode: 'TRANSACTION_CANNOT_BE_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n\n/**\n * Transaction was already voided\n */\nexport class TransactionAlreadyVoidedWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('TransactionAlreadyVoided');\n\n this.httpCode = 409;\n this.statusCode = 'ALREADY_EXISTS';\n this.applicationCode = 'TRANSACTION_ALREADY_VOIDED';\n this.name = 'TransactionAlreadyVoided';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'TransactionAlreadyVoided',\n applicationCode: 'TRANSACTION_ALREADY_VOIDED',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","export interface ListEligibleMembershipsRequest {\n /**\n * The line items for which to list eligible memberships.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * The selected payment memberships and which line items they apply to.\n *\n * When not provided, your implementation is expected to return the default selection.\n * When provided, your implementation is expected to validate and return it.\n */\n selectedMemberships?: SelectedMemberships;\n}\n\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Catalog and item reference info. */\n catalogReference?: CatalogReference;\n /** Properties of the service. When relevant, contains information such as date and number of participants. */\n serviceProperties?: ServiceProperties;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in key:value pairs. Use this optional field to provide more specificity with item selection. The `options` field values differ depending on which catalog is providing the items.\n *\n * For products and variants from a Wix Stores catalog, learn more about [eCommerce integration](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface ServiceProperties {\n /**\n * Date and time the service is to be provided, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format.\n * For example, the start time of a class.\n */\n scheduledDate?: Date | null;\n /**\n * The number of people participating in the service. For example, the number of people attending a class or the number of people per hotel room.\n * @min 1\n * @max 10000\n */\n numberOfParticipants?: number | null;\n}\n\nexport interface SelectedMemberships {\n /**\n * Selected memberships.\n * @maxSize 300\n */\n memberships?: SelectedMembership[];\n}\n\nexport interface SelectedMembership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * IDs of the line items this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface ListEligibleMembershipsResponse {\n /**\n * List of memberships that are eligible for the given member and line items.\n * @maxSize 300\n */\n eligibleMemberships?: Membership[];\n /**\n * List of memberships owned by the member, but cannot be used due to the reason provided.\n * @maxSize 300\n */\n invalidMemberships?: InvalidMembership[];\n /**\n * List of selected memberships and which line items they apply to.\n * @maxSize 300\n */\n selectedMemberships?: SelectedMembership[];\n}\n\nexport interface Membership {\n /**\n * Membership ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /** Membership name. */\n name?: MembershipName;\n /**\n * Line item IDs this membership applies to.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n /** Total and remaining membership credits. */\n credits?: MembershipPaymentCredits;\n /** Membership expiration date. */\n expirationDate?: Date | null;\n /** Additional data about this membership. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface MembershipName {\n /**\n * Membership name.\n * @maxLength 100\n */\n original?: string;\n /**\n * Translated membership name. Defaults to `original` when not provided.\n * @maxLength 100\n */\n translated?: string | null;\n}\n\nexport interface MembershipPaymentCredits {\n /**\n * Membership's initial value.\n * @min 1\n */\n total?: number;\n /** Membership's remaining value. */\n remaining?: number;\n}\n\nexport enum BalanceType {\n /** Balance is measured in discrete uses (e.g., sessions, visits). */\n PUNCH_CARD = 'PUNCH_CARD',\n /** Balance is measured in a currency-like value (e.g., points). */\n CREDIT = 'CREDIT',\n}\n\nexport interface InvalidMembership {\n /** The membership that is invalid and cannot be used. */\n membership?: Membership;\n /**\n * Reason why this membership is invalid.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string;\n}\n\nexport interface MembershipInvalidSelectionErrors {\n /**\n * Error details for invalid memberships.\n * @maxSize 300\n */\n membershipInvalidSelectionErrors?: MembershipInvalidSelectionError[];\n}\n\nexport interface MembershipInvalidSelectionError\n extends MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n /**\n * Membership ID.\n * @format GUID\n */\n membershipId?: string;\n /** Error type. */\n errorType?: MembershipErrorType;\n}\n\n/** @oneof */\nexport interface MembershipInvalidSelectionErrorErrorDataOneOf {\n /** Line item IDs that were missing. */\n lineItemNotFoundInfo?: LineItemNotFoundInfo;\n /** Error details for line items that cannot be used with this membership. */\n membershipCannotBeUsedForLineItemsInfo?: MembershipCannotBeUsedForLineItemsInfo;\n /**\n * Reason why this membership selection is invalid.\n * @maxLength 1000\n */\n membershipSelectionInvalidReason?: string | null;\n}\n\nexport enum MembershipErrorType {\n UNKNOWN = 'UNKNOWN',\n /** Membership not found. */\n MEMBERSHIP_NOT_FOUND = 'MEMBERSHIP_NOT_FOUND',\n /** The selection points to a line item ID that wasn't provided. */\n LINE_ITEM_NOT_FOUND = 'LINE_ITEM_NOT_FOUND',\n /** The membership cannot be used for the specific line items provided. */\n MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS = 'MEMBERSHIP_CANNOT_BE_USED_FOR_LINE_ITEMS',\n /** The membership can be used for each individual line item, but combining all of them is invalid. */\n MEMBERSHIP_SELECTION_INVALID = 'MEMBERSHIP_SELECTION_INVALID',\n}\n\nexport interface LineItemNotFoundInfo {\n /**\n * Line item IDs that were missing.\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n lineItemIds?: string[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemsInfo {\n /**\n * Line items that cannot be used with this membership, and the reason why.\n * @maxSize 300\n */\n lineItems?: MembershipCannotBeUsedForLineItemInfo[];\n}\n\nexport interface MembershipCannotBeUsedForLineItemInfo {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n lineItemId?: string;\n /**\n * Reason why this line item cannot be used with this membership.\n * @maxLength 1000\n */\n reason?: string;\n}\n\nexport interface ChargeMembershipRequest {\n /**\n * Member ID.\n *\n * Do not retrieve this from the request context. In some cases the caller is not a member, but a user who is using the membership on behalf of a member.\n * @format GUID\n */\n memberId: string;\n /**\n * Membership ID, as returned from the List Eligible Memberships call.\n * @minLength 1\n * @maxLength 100\n */\n membershipId: string;\n /**\n * Idempotency key to avoid duplicate charge.\n * The value will usually would be the same as `membershipId` + `orderId` + `rootCatalogItemId`.\n * @minLength 1\n * @maxLength 200\n */\n idempotencyKey: string;\n /**\n * Service properties.\n *\n * When relevant, this contains information such as date and number of participants.\n */\n serviceProperties?: ServiceProperties;\n /** Catalog and item reference info. */\n catalogReference: CatalogReference;\n /**\n * Root catalog item ID.\n *\n * The value will usually be the same as `catalogReference.catalogItemId`.\n * In cases when these are not the same, this field will return the actual ID of the item in the catalog.\n * For example, for Wix bookings, the value of `catalogReference.catalogItemId` is the booking ID, but `rootCatalogItemId` is set to the service ID.\n * @minLength 1\n * @maxLength 36\n */\n rootCatalogItemId?: string | null;\n /** Additional data about this charge. */\n additionalData?: Record<string, any> | null;\n}\n\nexport interface ChargeMembershipResponse {\n /**\n * The transaction ID for this charge.\n *\n * Use this ID to void the charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface MembershipCannotBeChargedError\n extends MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n /** Error type. */\n errorType?: MembershipCannotBeChargedType;\n}\n\n/** @oneof */\nexport interface MembershipCannotBeChargedErrorErrorDataOneOf {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n outOfCredits?: OutOfCredits;\n /** Membership has not become active yet. */\n notStartedYet?: NotStartedYet;\n /** Membership has expired or ended. */\n ended?: Ended;\n}\n\nexport enum MembershipCannotBeChargedType {\n /** Membership is out of credits. For example, 5 are required, but only 4 remain. */\n OUT_OF_CREDITS = 'OUT_OF_CREDITS',\n /** Membership has not become active yet. */\n NOT_STARTED_YET = 'NOT_STARTED_YET',\n /** Membership has expired or ended. */\n ENDED = 'ENDED',\n /** Not applicable for multiple participants. */\n NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS = 'NOT_APPLICABLE_FOR_MULTIPLE_PARTICIPANTS',\n}\n\nexport interface OutOfCredits {\n /** Required amount of credits. */\n required?: number;\n /** Remaining amount of credits. */\n remaining?: number;\n}\n\nexport interface NotStartedYet {\n /** Start date of the membership. */\n membershipStartDate?: Date | null;\n}\n\nexport interface Ended {\n /** End date of the membership. */\n endDate?: Date | null;\n}\n\nexport interface MembershipAlreadyChargedError {\n /**\n * ID of the transaction that was already used for membership charge.\n * @minLength 1\n * @maxLength 100\n */\n transactionId?: string;\n}\n\nexport interface GetMembershipVoidabilityRequest {\n /**\n * Transaction ID to check if it can be voided.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface GetMembershipVoidabilityResponse {\n /** Whether the membership charge can be voided. */\n voidable?: boolean;\n /**\n * Reason why the membership charge cannot be voided.\n * @minLength 1\n * @maxLength 200\n */\n reason?: string | null;\n}\n\nexport interface VoidMembershipChargeRequest {\n /**\n * Transaction ID to void.\n * @minLength 1\n * @maxLength 100\n */\n transactionId: string;\n}\n\nexport interface VoidMembershipChargeResponse {}\n\nexport interface MembershipsSPIConfig {\n /**\n * The base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI.\n * For example, to call the Charge Membership endpoint at https://my-memberships.com/v1/charge-membership, the base URI you provide here is https://my-memberships.com/.\n * @format WEB_URL\n */\n deploymentUri?: string;\n /**\n * The app IDs of the catalogs your app supports.\n * @minSize 1\n * @maxSize 300\n * @format GUID\n */\n catalogAppDefIds?: 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\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAkBlD,YAAY,OAAyC,CAAC,GAAG;AACvD,UAAM,kBAAkB;AAExB,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,kBACH;AACF,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAEA,SAAK,OAAO;AAAA,EACd;AAIF;AAAA;AAtCa,yBAqCK,SAAS;AAMpB,IAAM,8BAAN,cAA0C,MAAM;AAAA,EAcr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AQ;AAER,EAAAA,+BAAA,8CAA2C;AARjC,SAAAA;AAAA,GAAA;AAoHL,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;","names":["BalanceType","MembershipErrorType","MembershipCannotBeChargedType","IdentityType"]}
@@ -162,13 +162,19 @@ interface MembershipName {
162
162
  }
163
163
  interface MembershipPaymentCredits {
164
164
  /**
165
- * Membership's total amount of credits.
165
+ * Membership's initial value.
166
166
  * @min 1
167
167
  */
168
168
  total?: number;
169
- /** Membership's remaining amount of credits. */
169
+ /** Membership's remaining value. */
170
170
  remaining?: number;
171
171
  }
172
+ declare enum BalanceType {
173
+ /** Balance is measured in discrete uses (e.g., sessions, visits). */
174
+ PUNCH_CARD = "PUNCH_CARD",
175
+ /** Balance is measured in a currency-like value (e.g., points). */
176
+ CREDIT = "CREDIT"
177
+ }
172
178
  interface InvalidMembership {
173
179
  /** The membership that is invalid and cannot be used. */
174
180
  membership?: Membership;
@@ -546,6 +552,26 @@ declare class InvalidSelectionWixError extends Error {
546
552
  /** @hidden */
547
553
  static readonly __type = "wix_spi_error";
548
554
  }
555
+ /**
556
+ * The selected memberships do not have enough balance to cover the line items.
557
+ */
558
+ declare class InsufficientBalanceWixError extends Error {
559
+ /** @hidden */
560
+ httpCode: number;
561
+ /** @hidden */
562
+ statusCode: string;
563
+ /** @hidden */
564
+ applicationCode: string;
565
+ /** @hidden */
566
+ name: string;
567
+ /** @hidden */
568
+ errorType: string;
569
+ /** @hidden */
570
+ spiErrorData: object;
571
+ constructor();
572
+ /** @hidden */
573
+ static readonly __type = "wix_spi_error";
574
+ }
549
575
  /**
550
576
  * The membership was found, but does not apply for the provided item
551
577
  */
@@ -673,4 +699,4 @@ declare class TransactionAlreadyVoidedWixError extends Error {
673
699
  static readonly __type = "wix_spi_error";
674
700
  }
675
701
 
676
- export { type IdentificationDataIdOneOf as A, InvalidSelectionWixError as B, type CatalogReference as C, MembershipDoesNotApplyToItemWixError as D, type Ended as E, MembershipCannotBeUsedWixError as F, type GetMembershipVoidabilityRequest as G, MembershipAlreadyChargedWixError as H, type InvalidMembership as I, TransactionCannotBeVoidedWixError as J, TransactionAlreadyVoidedWixError as K, type ListEligibleMembershipsRequest as L, type Membership as M, type NotStartedYet as N, type OutOfCredits as O, type ListEligibleMembershipsEnvelope as P, type ChargeMembershipEnvelope as Q, type GetMembershipVoidabilityEnvelope as R, type ServiceProperties as S, TransactionNotFoundWixError as T, type VoidMembershipChargeEnvelope as U, type VoidMembershipChargeRequest as V, type LineItem as a, type SelectedMemberships as b, type SelectedMembership as c, type ListEligibleMembershipsResponse as d, type MembershipName as e, type MembershipPaymentCredits as f, type MembershipInvalidSelectionErrors as g, type MembershipInvalidSelectionError as h, type MembershipInvalidSelectionErrorErrorDataOneOf as i, MembershipErrorType as j, type LineItemNotFoundInfo as k, type MembershipCannotBeUsedForLineItemsInfo as l, type MembershipCannotBeUsedForLineItemInfo as m, type ChargeMembershipRequest as n, type ChargeMembershipResponse as o, provideHandlers as p, type MembershipCannotBeChargedError as q, type MembershipCannotBeChargedErrorErrorDataOneOf as r, MembershipCannotBeChargedType as s, type MembershipAlreadyChargedError as t, type GetMembershipVoidabilityResponse as u, type VoidMembershipChargeResponse as v, type MembershipsSPIConfig as w, type Context as x, IdentityType as y, type IdentificationData as z };
702
+ export { type IdentificationDataIdOneOf as A, BalanceType as B, type CatalogReference as C, InvalidSelectionWixError as D, type Ended as E, InsufficientBalanceWixError as F, type GetMembershipVoidabilityRequest as G, MembershipDoesNotApplyToItemWixError as H, type InvalidMembership as I, MembershipCannotBeUsedWixError as J, MembershipAlreadyChargedWixError as K, type ListEligibleMembershipsRequest as L, type Membership as M, type NotStartedYet as N, type OutOfCredits as O, TransactionCannotBeVoidedWixError as P, TransactionAlreadyVoidedWixError as Q, type ListEligibleMembershipsEnvelope as R, type ServiceProperties as S, TransactionNotFoundWixError as T, type ChargeMembershipEnvelope as U, type VoidMembershipChargeRequest as V, type GetMembershipVoidabilityEnvelope as W, type VoidMembershipChargeEnvelope as X, type LineItem as a, type SelectedMemberships as b, type SelectedMembership as c, type ListEligibleMembershipsResponse as d, type MembershipName as e, type MembershipPaymentCredits as f, type MembershipInvalidSelectionErrors as g, type MembershipInvalidSelectionError as h, type MembershipInvalidSelectionErrorErrorDataOneOf as i, MembershipErrorType as j, type LineItemNotFoundInfo as k, type MembershipCannotBeUsedForLineItemsInfo as l, type MembershipCannotBeUsedForLineItemInfo as m, type ChargeMembershipRequest as n, type ChargeMembershipResponse as o, provideHandlers as p, type MembershipCannotBeChargedError as q, type MembershipCannotBeChargedErrorErrorDataOneOf as r, MembershipCannotBeChargedType as s, type MembershipAlreadyChargedError as t, type GetMembershipVoidabilityResponse as u, type VoidMembershipChargeResponse as v, type MembershipsSPIConfig as w, type Context as x, IdentityType as y, type IdentificationData as z };
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-B9LHoDJG.mjs';
2
- export { C as CatalogReference, n as ChargeMembershipRequest, o as ChargeMembershipResponse, x as Context, E as Ended, G as GetMembershipVoidabilityRequest, u as GetMembershipVoidabilityResponse, z as IdentificationData, A as IdentificationDataIdOneOf, y as IdentityType, I as InvalidMembership, B as InvalidSelectionWixError, a as LineItem, k as LineItemNotFoundInfo, L as ListEligibleMembershipsRequest, d as ListEligibleMembershipsResponse, M as Membership, t as MembershipAlreadyChargedError, H as MembershipAlreadyChargedWixError, q as MembershipCannotBeChargedError, r as MembershipCannotBeChargedErrorErrorDataOneOf, s as MembershipCannotBeChargedType, m as MembershipCannotBeUsedForLineItemInfo, l as MembershipCannotBeUsedForLineItemsInfo, F as MembershipCannotBeUsedWixError, D as MembershipDoesNotApplyToItemWixError, j as MembershipErrorType, h as MembershipInvalidSelectionError, i as MembershipInvalidSelectionErrorErrorDataOneOf, g as MembershipInvalidSelectionErrors, e as MembershipName, f as MembershipPaymentCredits, w as MembershipsSPIConfig, N as NotStartedYet, O as OutOfCredits, c as SelectedMembership, b as SelectedMemberships, S as ServiceProperties, K as TransactionAlreadyVoidedWixError, J as TransactionCannotBeVoidedWixError, T as TransactionNotFoundWixError, V as VoidMembershipChargeRequest, v as VoidMembershipChargeResponse } from './service-plugins-error-classes-B9LHoDJG.mjs';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-DC9BuykL.mjs';
2
+ export { B as BalanceType, C as CatalogReference, n as ChargeMembershipRequest, o as ChargeMembershipResponse, x as Context, E as Ended, G as GetMembershipVoidabilityRequest, u as GetMembershipVoidabilityResponse, z as IdentificationData, A as IdentificationDataIdOneOf, y as IdentityType, F as InsufficientBalanceWixError, I as InvalidMembership, D as InvalidSelectionWixError, a as LineItem, k as LineItemNotFoundInfo, L as ListEligibleMembershipsRequest, d as ListEligibleMembershipsResponse, M as Membership, t as MembershipAlreadyChargedError, K as MembershipAlreadyChargedWixError, q as MembershipCannotBeChargedError, r as MembershipCannotBeChargedErrorErrorDataOneOf, s as MembershipCannotBeChargedType, m as MembershipCannotBeUsedForLineItemInfo, l as MembershipCannotBeUsedForLineItemsInfo, J as MembershipCannotBeUsedWixError, H as MembershipDoesNotApplyToItemWixError, j as MembershipErrorType, h as MembershipInvalidSelectionError, i as MembershipInvalidSelectionErrorErrorDataOneOf, g as MembershipInvalidSelectionErrors, e as MembershipName, f as MembershipPaymentCredits, w as MembershipsSPIConfig, N as NotStartedYet, O as OutOfCredits, c as SelectedMembership, b as SelectedMemberships, S as ServiceProperties, Q as TransactionAlreadyVoidedWixError, P as TransactionCannotBeVoidedWixError, T as TransactionNotFoundWixError, V as VoidMembershipChargeRequest, v as VoidMembershipChargeResponse } from './service-plugins-error-classes-DC9BuykL.mjs';
3
3
  import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
4
 
5
5
  declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
@@ -1,4 +1,9 @@
1
1
  // src/service-plugins-types.ts
2
+ var BalanceType = /* @__PURE__ */ ((BalanceType2) => {
3
+ BalanceType2["PUNCH_CARD"] = "PUNCH_CARD";
4
+ BalanceType2["CREDIT"] = "CREDIT";
5
+ return BalanceType2;
6
+ })(BalanceType || {});
2
7
  var MembershipErrorType = /* @__PURE__ */ ((MembershipErrorType2) => {
3
8
  MembershipErrorType2["UNKNOWN"] = "UNKNOWN";
4
9
  MembershipErrorType2["MEMBERSHIP_NOT_FOUND"] = "MEMBERSHIP_NOT_FOUND";
@@ -140,6 +145,22 @@ var InvalidSelectionWixError = class extends Error {
140
145
  };
141
146
  /** @hidden */
142
147
  InvalidSelectionWixError.__type = "wix_spi_error";
148
+ var InsufficientBalanceWixError = class extends Error {
149
+ constructor() {
150
+ super("InsufficientBalance");
151
+ this.httpCode = 428;
152
+ this.statusCode = "FAILED_PRECONDITION";
153
+ this.applicationCode = "INSUFFICIENT_BALANCE";
154
+ this.name = "InsufficientBalance";
155
+ this.errorType = "SPI";
156
+ this.spiErrorData = {
157
+ name: "InsufficientBalance",
158
+ applicationCode: "INSUFFICIENT_BALANCE"
159
+ };
160
+ }
161
+ };
162
+ /** @hidden */
163
+ InsufficientBalanceWixError.__type = "wix_spi_error";
143
164
  var MembershipDoesNotApplyToItemWixError = class extends Error {
144
165
  constructor() {
145
166
  super("MembershipDoesNotApplyToItem");
@@ -241,7 +262,9 @@ var TransactionAlreadyVoidedWixError = class extends Error {
241
262
  /** @hidden */
242
263
  TransactionAlreadyVoidedWixError.__type = "wix_spi_error";
243
264
  export {
265
+ BalanceType,
244
266
  IdentityType,
267
+ InsufficientBalanceWixError,
245
268
  InvalidSelectionWixError,
246
269
  MembershipAlreadyChargedWixError,
247
270
  MembershipCannotBeChargedType,