{"version":3,"file":"schema.mjs","names":["_enum"],"sources":["../../src/stripe/schema.ts"],"sourcesContent":["import type { Stripe } from 'stripe';\nimport {\n  _default,\n  enum as _enum,\n  gte,\n  int,\n  maxLength,\n  nullable,\n  object,\n  optional,\n  type output,\n  string,\n  url,\n} from 'zod/mini';\n\nexport const cancellationDetailsSchema = object({\n  comment: optional(nullable(string().check(maxLength(1024)))),\n  feedback: optional(\n    nullable(\n      _enum([\n        'customer_service',\n        'low_quality',\n        'missing_features',\n        'switched_service',\n        'too_complex',\n        'too_expensive',\n        'unused',\n        'other',\n      ])\n    )\n  ),\n  resubscribeIntent: optional(nullable(_enum(['maybe', 'no', 'yes']))),\n});\n\nexport function createCheckoutSessionSchema(productIds: string[]) {\n  return object({\n    quantity: _default(int().check(gte(1)), 1),\n    productId: _enum(productIds),\n    cancelUrl: optional(url()),\n    successUrl: optional(url()),\n  });\n}\n\n// The schema validates what a client may send; this is the stored/returned shape,\n// so `feedback` and `reason` take stripe's own open-ended enums — since 22.4 both\n// carry `OtherString`, and a Subscription.cancellation_details is assigned here\n// verbatim.\nexport interface CancellationDetails\n  extends Omit<output<typeof cancellationDetailsSchema>, 'feedback'> {\n  feedback?: Stripe.Subscription.CancellationDetails.Feedback | null;\n  reason?: Stripe.Subscription.CancellationDetails.Reason | null;\n}\n\nexport interface CreateCheckoutSessionDTO {\n  productId: string;\n  cancelUrl?: string;\n  successUrl?: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;\n}\n"],"mappings":";;AAeA,MAAa,4BAA4B,OAAO;CAC9C,SAAS,SAAS,SAAS,OAAO,CAAC,CAAC,MAAM,UAAU,IAAI,CAAC,CAAC,CAAC;CAC3D,UAAU,SACR,SACEA,OAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CACH,CACF;CACA,mBAAmB,SAAS,SAASA,OAAM;EAAC;EAAS;EAAM;CAAK,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,4BAA4B,YAAsB;CAChE,OAAO,OAAO;EACZ,UAAU,SAAS,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC;EACzC,WAAWA,OAAM,UAAU;EAC3B,WAAW,SAAS,IAAI,CAAC;EACzB,YAAY,SAAS,IAAI,CAAC;CAC5B,CAAC;AACH"}