{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'www.wixapis.com': [\n      {\n        srcPath: '/payments/platform/v1/checkout-sessions',\n        destPath: '/v1/checkout-sessions',\n      },\n      {\n        srcPath: '/payments/base44/v1/subscriptions',\n        destPath: '/v1/subscriptions',\n      },\n      {\n        srcPath: '/payments/platform/v1/service-plugin-registrations',\n        destPath: '/v1/service-plugin-registrations',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/checkout-sessions',\n        destPath: '',\n      },\n    ],\n    'manage.base44.com': [\n      {\n        srcPath: '/_api/checkout-sessions',\n        destPath: '',\n      },\n    ],\n    'payments.base44.com': [\n      {\n        srcPath: '/_api/checkout-sessions',\n        destPath: '',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/payments/platform/v1/checkout-sessions',\n        destPath: '/v1/checkout-sessions',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/payments/platform/v1/checkout-sessions',\n        destPath: '/v1/checkout-sessions',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items and returns its redirect URL\n * and session ID.\n *\n * Each call creates a new, independent session. The method isn't idempotent, so a retry produces\n * an additional session rather than recovering the prior one.\n */\nexport function generateCheckoutSession(\n  payload: object\n): RequestOptionsFactory<any> {\n  function __generateCheckoutSession({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.payments.platform.v1.checkout_session',\n      method: 'POST' as any,\n      methodFqn:\n        'wix.payments.platform.v1.CheckoutSessions.GenerateCheckoutSession',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n        protoPath: '/v1/checkout-sessions/generate',\n        data: payload,\n        host,\n      }),\n      data: payload,\n    };\n\n    return metadata;\n  }\n\n  return __generateCheckoutSession;\n}\n","/** A Wix-hosted checkout page generated for a specific set of line items. */\nexport interface CheckoutSession {\n  /**\n   * Checkout session ID.\n   * @readonly\n   * @format GUID\n   */\n  id?: string | null;\n  /**\n   * URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page\n   * as an anonymous shopper, and any session held by the calling app isn't carried over.\n   *\n   * The URL carries query parameters Wix needs to render the page correctly (for example, a\n   * `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the\n   * buyer unchanged. Don't strip, reorder, rewrite, or otherwise mutate its query string.\n   * @readonly\n   * @format WEB_URL\n   */\n  redirectUrl?: string | null;\n}\n\n/** Request to create a checkout session. */\nexport interface GenerateCheckoutSessionRequest {\n  /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\n  cart: Cart;\n  /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n  callbackUrls: CallbackUrls;\n}\n\n/**\n * Recurring subscription configuration for a line item.\n *\n * `LineItem.name` and `subscriptionInfo.title`/`description` render in different parts of the\n * Wix-hosted checkout page: `LineItem.name` is the line label in the cart-summary list, while\n * `subscriptionInfo.title` and `subscriptionInfo.description` are the heading and body text on the\n * recurring-billing summary block (the area that shows the buyer the cadence and the free-trial terms,\n * if any). Set them to complementary values rather than duplicating `LineItem.name`.\n */\nexport interface SubscriptionInfo {\n  /**\n   * Billing frequency, cycles, and free trial configuration. Required when `subscriptionInfo` is set on a\n   * line item.\n   */\n  subscriptionSettings?: SubscriptionSettings;\n  /**\n   * Subscription name shown to the buyer in the recurring-billing summary block on the Wix-hosted\n   * checkout page (the heading of that block).\n   * @maxLength 150\n   */\n  title?: string | null;\n  /**\n   * Subscription description shown to the buyer in the recurring-billing summary block on the\n   * Wix-hosted checkout page (the body text below the title).\n   * @maxLength 500\n   */\n  description?: string | null;\n}\n\n/**\n * Configuration for recurring subscription charges.\n *\n * `autoRenewal` and `billingCycles` are mutually exclusive. `autoRenewal: true` describes an\n * open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term\n * subscription that stops after N charges. Setting `autoRenewal: true` together with any\n * `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code\n * `AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT`).\n */\nexport interface SubscriptionSettings {\n  /** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */\n  frequency?: SubscriptionFrequencyWithLiterals;\n  /**\n   * Number of frequency units between charges. For `DAY` frequency, the minimum is 7. The shortest\n   * billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with\n   * `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.\n   *\n   * Note that `freeTrialPeriod.interval` doesn't share this floor: a `DAY` trial may have\n   * `interval` as low as 1.\n   * @min 1\n   * @max 3650\n   */\n  interval?: number | null;\n  /**\n   * Whether the subscription renews automatically. Can't be `true` when `billingCycles` is set.\n   *\n   * Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`\n   * is set and `autoRenewal` is omitted.\n   */\n  autoRenewal?: boolean | null;\n  /**\n   * Number of billing cycles before the subscription stops. Can't be set when `autoRenewal` is `true`.\n   *\n   * When omitted along with `autoRenewal`, the subscription renews indefinitely.\n   * @min 1\n   */\n  billingCycles?: number | null;\n  /** Free trial period before the first charge. */\n  freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n  /** Unknown frequency. */\n  UNDEFINED = 'UNDEFINED',\n  DAY = 'DAY',\n  WEEK = 'WEEK',\n  MONTH = 'MONTH',\n  YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n  | SubscriptionFrequency\n  | 'UNDEFINED'\n  | 'DAY'\n  | 'WEEK'\n  | 'MONTH'\n  | 'YEAR';\n\n/**\n * Free trial period before the first subscription charge.\n *\n * The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it\n * describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A\n * `frequency: MONTH` + `interval: 3` trial means \"a single 3-month trial,\" not \"billed every 3\n * months.\"\n */\nexport interface FreeTrialPeriod {\n  /**\n   * Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be\n   * treated as a client mistake and isn't a valid runtime value.\n   */\n  frequency?: SubscriptionFrequencyWithLiterals;\n  /**\n   * Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`\n   * gives a 14-day trial.\n   *\n   * Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1`. No weekly floor applies\n   * to the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code\n   * `MIN_VALUE`).\n   * @min 1\n   * @max 999\n   */\n  interval?: number;\n}\n\nexport interface PhysicalProperties {\n  /** Whether the item requires shipping. */\n  shippable?: boolean | null;\n}\n\nexport interface LineItem {\n  /**\n   * Name of the item, shown on the checkout page.\n   * @minLength 1\n   * @maxLength 255\n   */\n  name?: string | null;\n  /**\n   * Quantity of this item to charge for.\n   * @min 1\n   */\n  quantity?: number | null;\n  /**\n   * Per-unit price as a decimal string in the merchant account currency. For example, `\"19.99\"`.\n   * @minLength 1\n   * @maxLength 50\n   */\n  price?: string | null;\n  /**\n   * Subscription configuration. When set, the line item follows a scheduled-billing model defined by\n   * `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing\n   * cycle is `price × quantity`, and `quantity` is locked at session creation.\n   *\n   * At most 1 line item per request may set `subscriptionInfo`. Wix rejects requests with 2 or more\n   * subscription line items with `MULTIPLE_SUBSCRIPTION_ITEMS`.\n   */\n  subscriptionInfo?: SubscriptionInfo;\n  /** Optional. Physical properties of the item, used when the item requires shipping. */\n  physicalProperties?: PhysicalProperties;\n}\n\n/**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\nexport interface CustomerInfo {\n  /**\n   * Buyer's first name.\n   * @maxLength 100\n   */\n  firstName?: string | null;\n  /**\n   * Buyer's last name.\n   * @maxLength 100\n   */\n  lastName?: string | null;\n  /**\n   * Buyer's phone number.\n   * @format PHONE\n   */\n  phone?: string | null;\n  /**\n   * Buyer's email address.\n   * @format EMAIL\n   */\n  email?: string | null;\n}\n\n/** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\nexport interface Cart {\n  /**\n   * Line items the buyer is paying for in this checkout session.\n   *\n   * At most 1 subscription line item (an item with `subscriptionInfo` set) is allowed per request.\n   * Wix rejects requests with 2 or more subscription items. Non-recurring items can be combined with a\n   * single subscription item. In that case the buyer is charged once at checkout for the non-recurring\n   * items and, if applicable, the first cycle of the subscription. Wix bills any subsequent cycles on\n   * the subscription's own schedule.\n   * @maxSize 100\n   */\n  items?: LineItem[];\n  /**\n   * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n   * Wix checkout page.\n   */\n  customerInfo?: CustomerInfo;\n}\n\n/**\n * URLs the buyer is redirected to after the checkout flow.\n *\n * The buyer is sent to one of the URLs below: `continueBrowsingUrl` if they explicitly leave via\n * **Continue browsing**, or `thankYouPageUrl` after a successful payment.\n *\n * If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no\n * callback URL is invoked and the checkout session isn't resumed.\n */\nexport interface CallbackUrls {\n  /**\n   * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n   * completing payment, either when they click **Continue browsing** or when they navigate back to\n   * a cart-style page.\n   *\n   * Deprecated. Use `continueBrowsingUrl` instead.\n   * @format WEB_URL\n   * @deprecated\n   * @replacedBy continue_browsing_url\n   */\n  postFlowUrl?: string | null;\n  /**\n   * URL the buyer is redirected to after a successful payment.\n   * @format WEB_URL\n   */\n  thankYouPageUrl?: string | null;\n  /**\n   * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n   * completing payment, either when they click **Continue browsing** or when they navigate back to\n   * a cart-style page.\n   * @format WEB_URL\n   */\n  continueBrowsingUrl?: string | null;\n}\n\n/** Response after creating a checkout session. */\nexport interface GenerateCheckoutSessionResponse {\n  /** The created checkout session. */\n  checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n  /**\n   * URL to receive webhook notifications.\n   * @format WEB_URL\n   */\n  url?: string | null;\n  /**\n   * Webhook event types to register. Default: `[ORDER_APPROVED]`.\n   * @maxSize 10\n   */\n  webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Webhook event types to register. */\nexport enum WebhookType {\n  /** Order Approved webhook (`wix.ecom.v1.order_approved`). */\n  ORDER_APPROVED = 'ORDER_APPROVED',\n  /**\n   * Subscription Contract Canceled webhook\n   * (`wix.ecom.subscription_contracts.v1.subscription_contract_canceled`).\n   */\n  SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n  /**\n   * Subscription Contract Expired webhook\n   * (`wix.ecom.subscription_contracts.v1.subscription_contract_expired`).\n   */\n  SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n  | WebhookType\n  | 'ORDER_APPROVED'\n  | 'SUBSCRIPTION_CANCELED'\n  | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n  /**\n   * PEM-formatted RS256 public key used to verify the JWT signature on incoming webhook payloads.\n   * @maxLength 1000\n   */\n  publicKey?: string | null;\n}\n\n/** @docsIgnore */\nexport type GenerateCheckoutSessionApplicationErrors =\n  | {\n      code?: 'MULTIPLE_SUBSCRIPTION_ITEMS';\n      description?: string;\n      data?: Record<string, any>;\n    }\n  | {\n      code?: 'AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT';\n      description?: string;\n      data?: Record<string, any>;\n    };\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n  K = string,\n  M = unknown,\n  T = unknown,\n  S = unknown,\n  Q = unknown,\n  R = unknown\n> = {\n  getUrl: (context: any) => string;\n  httpMethod: K;\n  path: string;\n  pathParams: M;\n  __requestType: T;\n  __originalRequestType: S;\n  __responseType: Q;\n  __originalResponseType: R;\n};\n\nexport function generateCheckoutSession(): __PublicMethodMetaInfo<\n  'POST',\n  {},\n  ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.GenerateCheckoutSessionRequest,\n  ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.GenerateCheckoutSessionRequest,\n  ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.GenerateCheckoutSessionResponse,\n  ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.GenerateCheckoutSessionResponse\n> {\n  const payload = {} as any;\n\n  const getRequestOptions =\n    ambassadorWixPaymentsPlatformV1CheckoutSession.generateCheckoutSession(\n      payload\n    );\n\n  const getUrl = (context: any): string => {\n    const { url } = getRequestOptions(context);\n    return url!;\n  };\n\n  return {\n    getUrl,\n    httpMethod: 'POST',\n    path: '/v1/checkout-sessions/generate',\n    pathParams: {},\n    __requestType: null as any,\n    __originalRequestType: null as any,\n    __responseType: null as any,\n    __originalResponseType: null as any,\n  };\n}\n\nexport {\n  CheckoutSession as CheckoutSessionOriginal,\n  GenerateCheckoutSessionRequest as GenerateCheckoutSessionRequestOriginal,\n  SubscriptionInfo as SubscriptionInfoOriginal,\n  SubscriptionSettings as SubscriptionSettingsOriginal,\n  SubscriptionFrequency as SubscriptionFrequencyOriginal,\n  SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n  FreeTrialPeriod as FreeTrialPeriodOriginal,\n  PhysicalProperties as PhysicalPropertiesOriginal,\n  LineItem as LineItemOriginal,\n  CustomerInfo as CustomerInfoOriginal,\n  Cart as CartOriginal,\n  CallbackUrls as CallbackUrlsOriginal,\n  GenerateCheckoutSessionResponse as GenerateCheckoutSessionResponseOriginal,\n  RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n  WebhookType as WebhookTypeOriginal,\n  WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n  RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n  GenerateCheckoutSessionApplicationErrors as GenerateCheckoutSessionApplicationErrorsOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,uBAAuB;AAAA,MACrB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,s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