Skip to content

Instantly share code, notes, and snippets.

@almazmusic
Created December 23, 2023 15:12
Show Gist options
  • Save almazmusic/aafc91392a50f7ea185485e0935ed679 to your computer and use it in GitHub Desktop.
Save almazmusic/aafc91392a50f7ea185485e0935ed679 to your computer and use it in GitHub Desktop.
Linked keys and values
export type StatisticMetricType = "money" | "count" | "pct"
export type StatisticMetricBasic = {
amount: number
prevAmount: number | null
prevComparePercents: number | null
type: StatisticMetricType
}
export type StatisticMetricPPCEntities = {
sponsored_brands: "Sponsored Brands"
sponsored_products: "Sponsored Products"
sponsored_display: "Sponsored Display"
total_acos: "Total ACoS"
}
export type StatisticMetricPPCSubmetricEntities = {
sponsored_brands_product_collection: "Product collection"
sponsored_brands_store_spotlight: "Store spotlight"
sponsored_brands_video: "Video"
}
export type StatisticMetricTransactionsEntities = {
ordered_product_sales: "Product Sales"
revenue: "Revenue"
estimated_profit: "Estimated profit"
expenses: "Expenses"
margin: "Margin"
roi: "ROI"
orders: "Orders"
units: "Units"
refunds: "Refunds"
promotion_amount: "Promotion Amount"
}
export type StatisticMetricPPC = {
[K in keyof StatisticMetricPPCEntities]: {
id: K
name: StatisticMetricPPCEntities[K]
} & {
subMetrics?: {
[K in keyof StatisticMetricPPCSubmetricEntities]: {
id: K
name: StatisticMetricPPCSubmetricEntities[K]
}
}
}
}
export type StatisticMetricTransactions = {
[K in keyof StatisticMetricTransactionsEntities]: {
id: K
name: StatisticMetricTransactionsEntities[K]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment