From a0b34468520b3916c0b465d866932f1116fa7976 Mon Sep 17 00:00:00 2001 From: roushou Date: Sun, 7 Jul 2024 12:51:11 +0700 Subject: [PATCH] chore(commerce): extract `TimelineStatus` type --- .changeset/silver-mails-count.md | 5 +++++ packages/commerce/src/charge.ts | 10 +++++++++- packages/commerce/src/index.ts | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/silver-mails-count.md diff --git a/.changeset/silver-mails-count.md b/.changeset/silver-mails-count.md new file mode 100644 index 0000000..dbe848a --- /dev/null +++ b/.changeset/silver-mails-count.md @@ -0,0 +1,5 @@ +--- +"@coinbasejs/commerce": patch +--- + +chore(commerce): extract `TimelineStatus` type diff --git a/packages/commerce/src/charge.ts b/packages/commerce/src/charge.ts index c85c63c..0e3dca7 100644 --- a/packages/commerce/src/charge.ts +++ b/packages/commerce/src/charge.ts @@ -61,6 +61,14 @@ export async function createCharge( export type ChargePricingType = "fixed_price" | "no_price"; +export type TimelineStatus = + | "COMPLETED" + | "EXPIRED" + | "FAILED" + | "NEW" + | "PENDING" + | "SIGNED"; + export type Charge = { brand_color: string; brand_logo_url: string; @@ -92,7 +100,7 @@ export type Charge = { support_email: string; third_party_provider: string; timeline: Array<{ - status: "COMPLETED" | "EXPIRED" | "FAILED" | "NEW" | "PENDING" | "SIGNED"; + status: TimelineStatus; time: string; }>; web3_data: { diff --git a/packages/commerce/src/index.ts b/packages/commerce/src/index.ts index c7d9455..88e1830 100644 --- a/packages/commerce/src/index.ts +++ b/packages/commerce/src/index.ts @@ -9,6 +9,7 @@ export type { CreateChargeResponse, GetChargeResponse, GetChargesResponse, + TimelineStatus, } from "./charge"; export { createCheckout, getCheckout, getCheckouts } from "./checkout"; export type {