feat: global platform v2 update
This commit is contained in:
@@ -14,40 +14,8 @@ export const STORAGE_KEYS = {
|
||||
ACCESS_TOKEN: "tgex_access_token",
|
||||
REFRESH_TOKEN: "tgex_refresh_token",
|
||||
USER: "tgex_user",
|
||||
SELECTED_TARGET_CHANNEL: "tgex_selected_target_channel",
|
||||
} as const;
|
||||
|
||||
// API Endpoints
|
||||
export const API_ENDPOINTS = {
|
||||
// Auth
|
||||
AUTH_INIT: "/auth/init",
|
||||
AUTH_COMPLETE: "/auth/complete",
|
||||
AUTH_REFRESH: "/auth/refresh",
|
||||
AUTH_ME: "/auth/me",
|
||||
|
||||
// Target Channels
|
||||
TARGET_CHANNELS: "/target-channels",
|
||||
TARGET_CHANNEL: (id: string) => `/target-channels/${id}`,
|
||||
|
||||
// External Channels
|
||||
EXTERNAL_CHANNELS: "/external-channels",
|
||||
EXTERNAL_CHANNEL: (id: string) => `/external-channels/${id}`,
|
||||
EXTERNAL_CHANNELS_IMPORT: "/external-channels/import",
|
||||
|
||||
// Creatives
|
||||
CREATIVES: "/creatives",
|
||||
CREATIVE: (id: string) => `/creatives/${id}`,
|
||||
|
||||
// Purchases
|
||||
PURCHASES: "/purchases",
|
||||
PURCHASE: (id: string) => `/purchases/${id}`,
|
||||
PURCHASE_REFRESH_VIEWS: (id: string) => `/purchases/${id}/refresh-views`,
|
||||
|
||||
// Analytics
|
||||
ANALYTICS_OVERVIEW: "/analytics/overview",
|
||||
ANALYTICS_COSTS: "/analytics/costs",
|
||||
ANALYTICS_CHANNELS: "/analytics/channels",
|
||||
ANALYTICS_CREATIVES: "/analytics/creatives",
|
||||
SELECTED_WORKSPACE: "tgex_selected_workspace",
|
||||
SELECTED_PROJECT: "tgex_selected_project",
|
||||
} as const;
|
||||
|
||||
// Error Codes
|
||||
@@ -57,11 +25,6 @@ export const ERROR_CODES = {
|
||||
NOT_FOUND: "NOT_FOUND",
|
||||
VALIDATION_ERROR: "VALIDATION_ERROR",
|
||||
INTERNAL_ERROR: "INTERNAL_ERROR",
|
||||
CHANNEL_NOT_FOUND: "CHANNEL_NOT_FOUND",
|
||||
CHANNEL_ALREADY_EXISTS: "CHANNEL_ALREADY_EXISTS",
|
||||
INSUFFICIENT_PERMISSIONS: "INSUFFICIENT_PERMISSIONS",
|
||||
CREATIVE_IN_USE: "CREATIVE_IN_USE",
|
||||
INVALID_INVITE_LINK: "INVALID_INVITE_LINK",
|
||||
} as const;
|
||||
|
||||
// Date Formats
|
||||
@@ -72,34 +35,57 @@ export const DATE_FORMATS = {
|
||||
} as const;
|
||||
|
||||
// Pagination
|
||||
export const DEFAULT_PAGE_SIZE = 20;
|
||||
export const DEFAULT_PAGE_SIZE = 50;
|
||||
export const PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
|
||||
|
||||
// Routes
|
||||
// Routes Builder
|
||||
export const buildRoute = {
|
||||
// Dashboard
|
||||
dashboard: (workspaceId: string) => `/dashboard/${workspaceId}`,
|
||||
|
||||
// Projects
|
||||
projects: (workspaceId: string) => `/dashboard/${workspaceId}/projects`,
|
||||
|
||||
// Channels
|
||||
channels: (workspaceId: string) => `/dashboard/${workspaceId}/channels`,
|
||||
|
||||
// Purchase Plan
|
||||
purchasePlans: (workspaceId: string) => `/dashboard/${workspaceId}/purchase-plans`,
|
||||
purchasePlan: (workspaceId: string, projectId: string) =>
|
||||
`/dashboard/${workspaceId}/purchase-plans/${projectId}`,
|
||||
|
||||
// Creatives
|
||||
creatives: (workspaceId: string) => `/dashboard/${workspaceId}/creatives`,
|
||||
creativeNew: (workspaceId: string) => `/dashboard/${workspaceId}/creatives/new`,
|
||||
creativeDetail: (workspaceId: string, creativeId: string) =>
|
||||
`/dashboard/${workspaceId}/creatives/${creativeId}`,
|
||||
|
||||
// Placements
|
||||
placements: (workspaceId: string) => `/dashboard/${workspaceId}/placements`,
|
||||
placementNew: (workspaceId: string) => `/dashboard/${workspaceId}/placements/new`,
|
||||
placementDetail: (workspaceId: string, placementId: string) =>
|
||||
`/dashboard/${workspaceId}/placements/${placementId}`,
|
||||
|
||||
// Analytics
|
||||
analytics: (workspaceId: string) => `/dashboard/${workspaceId}/analytics`,
|
||||
analyticsSpending: (workspaceId: string) =>
|
||||
`/dashboard/${workspaceId}/analytics/spending`,
|
||||
analyticsCreatives: (workspaceId: string) =>
|
||||
`/dashboard/${workspaceId}/analytics/creatives`,
|
||||
analyticsChannels: (workspaceId: string) =>
|
||||
`/dashboard/${workspaceId}/analytics/channels`,
|
||||
analyticsPlacements: (workspaceId: string) =>
|
||||
`/dashboard/${workspaceId}/analytics/placements`,
|
||||
|
||||
// Settings
|
||||
settings: (workspaceId: string) => `/dashboard/${workspaceId}/settings`,
|
||||
members: (workspaceId: string) => `/dashboard/${workspaceId}/settings/members`,
|
||||
invites: (workspaceId: string) => `/dashboard/${workspaceId}/settings/invites`,
|
||||
} as const;
|
||||
|
||||
// Static routes
|
||||
export const ROUTES = {
|
||||
HOME: "/",
|
||||
LOGIN: "/login",
|
||||
AUTH_COMPLETE: "/auth/complete",
|
||||
|
||||
CHANNELS: "/channels",
|
||||
CHANNEL_DETAIL: (id: string) => `/channels/${id}`,
|
||||
|
||||
EXTERNAL_CHANNELS: "/external-channels",
|
||||
EXTERNAL_CHANNEL_DETAIL: (id: string) => `/external-channels/${id}`,
|
||||
EXTERNAL_CHANNELS_IMPORT: "/external-channels/import",
|
||||
|
||||
CREATIVES: "/creatives",
|
||||
CREATIVE_NEW: "/creatives/new",
|
||||
CREATIVE_DETAIL: (id: string) => `/creatives/${id}`,
|
||||
CREATIVE_EDIT: (id: string) => `/creatives/${id}/edit`,
|
||||
|
||||
PURCHASES: "/purchases",
|
||||
PURCHASE_NEW: "/purchases/new",
|
||||
PURCHASE_DETAIL: (id: string) => `/purchases/${id}`,
|
||||
PURCHASE_EDIT: (id: string) => `/purchases/${id}/edit`,
|
||||
|
||||
ANALYTICS: "/analytics",
|
||||
ANALYTICS_COSTS: "/analytics/costs",
|
||||
ANALYTICS_CHANNELS: "/analytics/channels",
|
||||
ANALYTICS_CREATIVES: "/analytics/creatives",
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user