fix(admin-next,types): fix some http type names (#8836)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { createColumnHelper } from "@tanstack/react-table"
|
||||
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { DateCell } from "../../../components/table/table-cells/common/date-cell"
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
NameHeader,
|
||||
} from "../../../components/table/table-cells/sales-channel/name-cell"
|
||||
|
||||
const columnHelper = createColumnHelper<CampaignResponse>()
|
||||
const columnHelper = createColumnHelper<AdminCampaign>()
|
||||
|
||||
export const useCampaignTableColumns = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { CampaignResponse, PromotionDTO } from "@medusajs/types"
|
||||
import { AdminCampaign, PromotionDTO } from "@medusajs/types"
|
||||
import { Button, Checkbox, Hint, Tooltip, toast } from "@medusajs/ui"
|
||||
import { keepPreviousData } from "@tanstack/react-query"
|
||||
import {
|
||||
@@ -21,7 +21,7 @@ import { usePromotionTableQuery } from "../../../../hooks/table/query-v2/use-pro
|
||||
import { useDataTable } from "../../../../hooks/use-data-table"
|
||||
|
||||
type AddCampaignPromotionsFormProps = {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
const AddCampaignPromotionsSchema = zod.object({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { Button, CurrencyInput, Input, toast } from "@medusajs/ui"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
@@ -10,7 +10,7 @@ import { useUpdateCampaign } from "../../../../../hooks/api/campaigns"
|
||||
import { getCurrencySymbol } from "../../../../../lib/data/currencies"
|
||||
|
||||
type EditCampaignBudgetFormProps = {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
const EditCampaignSchema = zod.object({
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ChartPie, PencilSquare } from "@medusajs/icons"
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { Container, Heading, Text } from "@medusajs/ui"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { ActionMenu } from "../../../../../components/common/action-menu"
|
||||
|
||||
type CampaignBudgetProps = {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
export const CampaignBudget = ({ campaign }: CampaignBudgetProps) => {
|
||||
@@ -15,14 +15,14 @@ export const CampaignBudget = ({ campaign }: CampaignBudgetProps) => {
|
||||
<Container className="flex flex-col gap-y-4 px-6 py-4">
|
||||
<div className="flex justify-between">
|
||||
<div className="flex-grow">
|
||||
<div className="float-left bg-ui-bg-base shadow-borders-base flex size-7 items-center justify-center rounded-md">
|
||||
<div className="bg-ui-bg-base shadow-borders-base float-left flex size-7 items-center justify-center rounded-md">
|
||||
<div className="bg-ui-bg-component flex size-6 items-center justify-center rounded-[4px]">
|
||||
<ChartPie className="text-ui-fg-subtle" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Heading
|
||||
className="ml-10 mt-[1.5px] font-normal text-ui-fg-subtle"
|
||||
className="text-ui-fg-subtle ml-10 mt-[1.5px] font-normal"
|
||||
level="h3"
|
||||
>
|
||||
{t("campaigns.fields.budget_limit")}
|
||||
@@ -46,7 +46,7 @@ export const CampaignBudget = ({ campaign }: CampaignBudgetProps) => {
|
||||
|
||||
<div>
|
||||
<Text
|
||||
className="text-ui-fg-subtle border-l-4 border-ui-border-strong pl-3"
|
||||
className="text-ui-fg-subtle border-ui-border-strong border-l-4 pl-3"
|
||||
size="small"
|
||||
leading="compact"
|
||||
>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PencilSquare, Trash } from "@medusajs/icons"
|
||||
import { CampaignResponse, PromotionReponse } from "@medusajs/types"
|
||||
import { AdminCampaign, AdminPromotion } from "@medusajs/types"
|
||||
import { Button, Checkbox, Container, Heading, usePrompt } from "@medusajs/ui"
|
||||
import { RowSelectionState, createColumnHelper } from "@tanstack/react-table"
|
||||
import { useMemo, useState } from "react"
|
||||
@@ -16,7 +16,7 @@ import { usePromotionTableQuery } from "../../../../../hooks/table/query-v2/use-
|
||||
import { useDataTable } from "../../../../../hooks/use-data-table"
|
||||
|
||||
type CampaignPromotionSectionProps = {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
const PAGE_SIZE = 10
|
||||
@@ -127,7 +127,7 @@ const PromotionActions = ({
|
||||
promotion,
|
||||
campaignId,
|
||||
}: {
|
||||
promotion: PromotionReponse
|
||||
promotion: AdminPromotion
|
||||
campaignId: string
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
@@ -182,7 +182,7 @@ const PromotionActions = ({
|
||||
)
|
||||
}
|
||||
|
||||
const columnHelper = createColumnHelper<PromotionReponse>()
|
||||
const columnHelper = createColumnHelper<AdminPromotion>()
|
||||
|
||||
const useColumns = () => {
|
||||
const columns = usePromotionTableColumns()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { CurrencyDollar } from "@medusajs/icons"
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { Container, Heading, Text } from "@medusajs/ui"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
|
||||
type CampaignSpendProps = {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
export const CampaignSpend = ({ campaign }: CampaignSpendProps) => {
|
||||
@@ -12,14 +12,14 @@ export const CampaignSpend = ({ campaign }: CampaignSpendProps) => {
|
||||
|
||||
return (
|
||||
<Container className="flex flex-col gap-y-4 px-6 py-4">
|
||||
<div className="grid grid-cols-[28px_1fr] items-center gap-x-3 mb-2">
|
||||
<div className="mb-2 grid grid-cols-[28px_1fr] items-center gap-x-3">
|
||||
<div className="bg-ui-bg-base shadow-borders-base flex size-7 items-center justify-center rounded-md">
|
||||
<div className="bg-ui-bg-component flex size-6 items-center justify-center rounded-[4px]">
|
||||
<CurrencyDollar className="text-ui-fg-subtle" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Heading level="h3" className="font-normal text-ui-fg-subtle">
|
||||
<Heading level="h3" className="text-ui-fg-subtle font-normal">
|
||||
{campaign.budget?.type === "spend"
|
||||
? t("campaigns.fields.total_spend")
|
||||
: t("campaigns.fields.total_used")}
|
||||
@@ -28,7 +28,7 @@ export const CampaignSpend = ({ campaign }: CampaignSpendProps) => {
|
||||
|
||||
<div>
|
||||
<Text
|
||||
className="text-ui-fg-subtle border-l-4 border-ui-border-strong pl-3"
|
||||
className="text-ui-fg-subtle border-ui-border-strong border-l-4 pl-3"
|
||||
size="small"
|
||||
leading="compact"
|
||||
>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { Button, DatePicker, Input, toast } from "@medusajs/ui"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
@@ -9,7 +9,7 @@ import { RouteDrawer, useRouteModal } from "../../../../../components/modals"
|
||||
import { useUpdateCampaign } from "../../../../../hooks/api/campaigns"
|
||||
|
||||
type EditCampaignFormProps = {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
const EditCampaignSchema = zod.object({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PencilSquare, Trash } from "@medusajs/icons"
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { Button, Container, Heading, toast, usePrompt } from "@medusajs/ui"
|
||||
import { keepPreviousData } from "@tanstack/react-query"
|
||||
import { createColumnHelper } from "@tanstack/react-table"
|
||||
@@ -74,7 +74,7 @@ export const CampaignListTable = () => {
|
||||
)
|
||||
}
|
||||
|
||||
const CampaignActions = ({ campaign }: { campaign: CampaignResponse }) => {
|
||||
const CampaignActions = ({ campaign }: { campaign: AdminCampaign }) => {
|
||||
const { t } = useTranslation()
|
||||
const prompt = usePrompt()
|
||||
const { mutateAsync } = useDeleteCampaign(campaign.id)
|
||||
@@ -131,7 +131,7 @@ const CampaignActions = ({ campaign }: { campaign: CampaignResponse }) => {
|
||||
)
|
||||
}
|
||||
|
||||
const columnHelper = createColumnHelper<CampaignResponse>()
|
||||
const columnHelper = createColumnHelper<AdminCampaign>()
|
||||
|
||||
const useColumns = () => {
|
||||
const base = useCampaignTableColumns()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { isAfter, isBefore } from "date-fns"
|
||||
|
||||
export function campaignStatus(campaign: CampaignResponse) {
|
||||
export function campaignStatus(campaign: AdminCampaign) {
|
||||
if (campaign.ends_at) {
|
||||
if (isBefore(new Date(campaign.ends_at), new Date())) {
|
||||
return "expired"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { CampaignResponse, PromotionDTO } from "@medusajs/types"
|
||||
import { AdminCampaign, AdminPromotion } from "@medusajs/types"
|
||||
import { Button, RadioGroup, Select, Text } from "@medusajs/ui"
|
||||
import { useEffect } from "react"
|
||||
import { useForm, useWatch } from "react-hook-form"
|
||||
@@ -12,8 +12,8 @@ import { CreateCampaignFormFields } from "../../../../campaigns/common/component
|
||||
import { CampaignDetails } from "./campaign-details"
|
||||
|
||||
type EditPromotionFormProps = {
|
||||
promotion: PromotionDTO
|
||||
campaigns: CampaignResponse[]
|
||||
promotion: AdminPromotion
|
||||
campaigns: AdminCampaign[]
|
||||
}
|
||||
|
||||
const EditPromotionSchema = zod.object({
|
||||
@@ -27,7 +27,7 @@ export const AddCampaignPromotionFields = ({
|
||||
withNewCampaign = true,
|
||||
}: {
|
||||
form: any
|
||||
campaigns: CampaignResponse[]
|
||||
campaigns: AdminCampaign[]
|
||||
withNewCampaign?: boolean
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { CampaignResponse } from "@medusajs/types"
|
||||
import { AdminCampaign } from "@medusajs/types"
|
||||
import { Heading, Text } from "@medusajs/ui"
|
||||
import { Fragment } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
type CampaignDetailsProps = {
|
||||
campaign?: CampaignResponse
|
||||
campaign?: AdminCampaign
|
||||
}
|
||||
|
||||
export const CampaignDetails = ({ campaign }: CampaignDetailsProps) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ApiKeyType } from "../../../api-key"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
interface ApiKeyResponse {
|
||||
interface AdminApiKey {
|
||||
id: string
|
||||
token: string
|
||||
redacted: string
|
||||
@@ -15,9 +15,9 @@ interface ApiKeyResponse {
|
||||
}
|
||||
|
||||
export interface AdminApiKeyResponse {
|
||||
api_key: ApiKeyResponse
|
||||
api_key: AdminApiKey
|
||||
}
|
||||
|
||||
export type AdminApiKeyListResponse = PaginatedResponse<{
|
||||
api_keys: ApiKeyResponse[]
|
||||
api_keys: AdminApiKey[]
|
||||
}>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CampaignBudgetTypeValues } from "../../../promotion"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
export interface CampaignResponse {
|
||||
export interface AdminCampaign {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
@@ -19,9 +19,9 @@ export interface CampaignResponse {
|
||||
}
|
||||
|
||||
export type AdminCampaignListResponse = PaginatedResponse<{
|
||||
campaigns: CampaignResponse[]
|
||||
campaigns: AdminCampaign[]
|
||||
}>
|
||||
|
||||
export interface AdminCampaignResponse {
|
||||
campaign: CampaignResponse
|
||||
campaign: AdminCampaign
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
PromotionRuleOperatorValues,
|
||||
PromotionTypeValues
|
||||
} from "../../promotion"
|
||||
import { CampaignResponse } from "../campaign"
|
||||
import { AdminCampaign } from "../campaign"
|
||||
|
||||
export interface BasePromotionRule {
|
||||
id: string
|
||||
@@ -38,7 +38,7 @@ export interface BasePromotion {
|
||||
application_method?: BaseApplicationMethod
|
||||
rules?: BasePromotionRule[]
|
||||
campaign_id?: string
|
||||
campaign?: CampaignResponse
|
||||
campaign?: AdminCampaign
|
||||
}
|
||||
|
||||
export interface BasePromotionRuleValue {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface ReservationResponse {
|
||||
export interface AdminReservation {
|
||||
id: string
|
||||
line_item_id: string | null
|
||||
location_id: string
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { ReservationResponse } from "./entities"
|
||||
import { AdminReservation } from "./entities"
|
||||
|
||||
export interface AdminReservationResponse {
|
||||
reservation: ReservationResponse
|
||||
reservation: AdminReservation
|
||||
}
|
||||
|
||||
export type AdminReservationListResponse = PaginatedResponse<{
|
||||
reservations: ReservationResponse[]
|
||||
reservations: AdminReservation[]
|
||||
}>
|
||||
|
||||
Reference in New Issue
Block a user