{"version":3,"file":"schema.cjs","names":[],"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,6BAAA,GAAA,SAAA,OAAA,CAAmC;CAC9C,UAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,OAAA,CAAkC,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,IAAI,CAAC,CAAC,CAAC;CAC3D,WAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,KAAA,CAEU;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CACH,CACF;CACA,oBAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,KAAA,CAA2C;EAAC;EAAS;EAAM;CAAK,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,4BAA4B,YAAsB;CAChE,QAAA,GAAA,SAAA,OAAA,CAAc;EACZ,WAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,IAAA,CAAuB,CAAC,CAAC,OAAA,GAAA,SAAA,IAAA,CAAU,CAAC,CAAC,GAAG,CAAC;EACzC,YAAA,GAAA,SAAA,KAAA,CAAiB,UAAU;EAC3B,YAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,IAAA,CAAwB,CAAC;EACzB,aAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,IAAA,CAAyB,CAAC;CAC5B,CAAC;AACH"}