import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateCustomerRequestBody = { /** * The customer's email address. */ email?: string | null | undefined; /** * The customer's name. If not provided, the email address will be used, and if email is not provided, a random name will be generated. */ name?: string | null | undefined; /** * The customer's avatar URL. If not provided, a random avatar will be generated. */ avatar?: string | null | undefined; /** * The customer's unique identifier your database. This is useful for associating subsequent conversion events from Dub's API to your internal systems. */ externalId?: string | undefined; /** * The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer. */ stripeCustomerId?: string | null | undefined; /** * The customer's country in ISO 3166-1 alpha-2 format. Updating this field will only affect the customer's country in Dub's system (and has no effect on existing conversion events). */ country?: string | undefined; }; export type UpdateCustomerRequest = { /** * The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`). */ id: string; /** * Whether to include expanded fields on the customer (`link`, `partner`, `discount`). */ includeExpandedFields?: boolean | undefined; requestBody?: UpdateCustomerRequestBody | undefined; }; export type UpdateCustomerLink = { /** * The unique ID of the short link. */ id: string; /** * The domain of the short link. If not provided, the primary domain for the workspace will be used (or `dub.sh` if the workspace has no domains). */ domain: string; /** * The short link slug. If not provided, a random 7-character slug will be generated. */ key: string; /** * The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`). */ shortLink: string; /** * The destination URL of the short link. */ url: string; /** * The ID of the program the short link is associated with. */ programId: string | null; }; export type UpdateCustomerPartner = { /** * The partner's unique ID on Dub. */ id: string; /** * The partner's full legal name. */ name: string; /** * The partner's email address. Should be a unique value across Dub. */ email: string | null; /** * The partner's avatar image. */ image: string | null; }; export declare const UpdateCustomerType: { readonly Percentage: "percentage"; readonly Flat: "flat"; }; export type UpdateCustomerType = ClosedEnum; export type UpdateCustomerDiscount = { id: string; amount: number; type: UpdateCustomerType; maxDuration: number | null; couponId: string | null; couponTestId: string | null; description?: string | null | undefined; partnersCount?: number | null | undefined; }; /** * The customer was updated. */ export type UpdateCustomerResponseBody = { /** * The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`). */ id: string; /** * Name of the customer. */ name: string; /** * Email of the customer. */ email?: string | null | undefined; /** * Avatar URL of the customer. */ avatar?: string | null | undefined; /** * Unique identifier for the customer in the client's app. */ externalId: string; /** * The customer's Stripe customer ID. This is useful for attributing recurring sale events to the partner who referred the customer. */ stripeCustomerId?: string | null | undefined; /** * Country of the customer. */ country?: string | null | undefined; /** * Total number of sales for the customer. */ sales?: number | null | undefined; /** * Total amount of sales for the customer. */ saleAmount?: number | null | undefined; /** * The date the customer was created (usually the signup date or trial start date). */ createdAt: string; /** * The date the customer made their first sale. Useful for calculating the time to first sale and LTV. */ firstSaleAt?: string | null | undefined; /** * The date the customer canceled their subscription. Useful for calculating LTV and churn rate. */ subscriptionCanceledAt?: string | null | undefined; link?: UpdateCustomerLink | null | undefined; programId?: string | null | undefined; partner?: UpdateCustomerPartner | null | undefined; discount?: UpdateCustomerDiscount | null | undefined; }; /** @internal */ export type UpdateCustomerRequestBody$Outbound = { email?: string | null | undefined; name?: string | null | undefined; avatar?: string | null | undefined; externalId?: string | undefined; stripeCustomerId?: string | null | undefined; country?: string | undefined; }; /** @internal */ export declare const UpdateCustomerRequestBody$outboundSchema: z.ZodType; export declare function updateCustomerRequestBodyToJSON(updateCustomerRequestBody: UpdateCustomerRequestBody): string; /** @internal */ export type UpdateCustomerRequest$Outbound = { id: string; includeExpandedFields?: boolean | undefined; RequestBody?: UpdateCustomerRequestBody$Outbound | undefined; }; /** @internal */ export declare const UpdateCustomerRequest$outboundSchema: z.ZodType; export declare function updateCustomerRequestToJSON(updateCustomerRequest: UpdateCustomerRequest): string; /** @internal */ export declare const UpdateCustomerLink$inboundSchema: z.ZodType; export declare function updateCustomerLinkFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const UpdateCustomerPartner$inboundSchema: z.ZodType; export declare function updateCustomerPartnerFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const UpdateCustomerType$inboundSchema: z.ZodNativeEnum; /** @internal */ export declare const UpdateCustomerDiscount$inboundSchema: z.ZodType; export declare function updateCustomerDiscountFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const UpdateCustomerResponseBody$inboundSchema: z.ZodType; export declare function updateCustomerResponseBodyFromJSON(jsonString: string): SafeParseResult; //# sourceMappingURL=updatecustomer.d.ts.map