Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

1.2 KB
Raw Blame
import * as z from "zod/v4";

export const shopifyOrderSchema = z.object({
  confirmation_number: z.string(),
  checkout_token: z.string(),
  customer: z
    .object({
      id: z.union([z.number(), z.string()]),
      email: z.string().nullish(),
      first_name: z.string().nullish(),
      last_name: z.string().nullish(),
    })
    .nullish(),
  current_subtotal_price_set: z.object({
    shop_money: z
      .object({
        amount: z.string(),
        currency_code: z.string(),
      })
      .describe("Amount in shop currency."),
  }),
  discount_codes: z.array(
    z.object({
      code: z.string().describe("The code of the discount."),
    }),
  ),
  billing_address: z
    .object({
      province: z.string().nullish(),
      country_code: z.string().nullish(),
    })
    .nullish(),
  note_attributes: z
    .array(
      z.object({
        name: z.string(), // dubClickId
        value: z.string().nullish(),
      }),
    )
    .default([]),
});

export const integrationCredentialsSchema = z.object({
  accessToken: z
    .string()
    .nullish()
    .describe("Encrypted access token for the Shopify store."),
  scope: z.string().nullish().describe("Scope of the Shopify store."),
});

export type ShopifyOrder = z.infer<typeof shopifyOrderSchema>;