feat(medusa,types): create promotion flows (#7029)

* chore: create promotion phase

* chore: fix specs + minor ui changes

* chore: minor fixes

* chore: added changeset

* address pr reviews

* chore: fix spec

* Update packages/admin-next/dashboard/src/v2-routes/promotions/common/edit-rules/edit-rules.tsx

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>

* chore: fix specs

---------

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
This commit is contained in:
Riqwan Thamir
2024-04-23 12:08:39 +02:00
committed by GitHub
co-authored by Frane Polić
parent b61dcb84c9
commit 93ef94cad3
37 changed files with 1807 additions and 569 deletions
@@ -0,0 +1,34 @@
import { PaginatedResponse } from "../../common"
/**
* @experimental
*/
export interface CampaignResponse {
id: string
name: string
description: string
currency: string
campaign_identifier: string
starts_at: string
ends_at: string
budget: {
id: string
type: string
limit: number | null
used: number
}
}
/**
* @experimental
*/
export interface AdminCampaignListResponse extends PaginatedResponse {
campaigns: CampaignResponse[]
}
/**
* @experimental
*/
export interface AdminCampaignResponse {
campaign: CampaignResponse
}
@@ -0,0 +1 @@
export * from "./campaign"
@@ -0,0 +1 @@
export * from "./admin"
+2
View File
@@ -1,10 +1,12 @@
export * from "./api-key"
export * from "./campaign"
export * from "./customer"
export * from "./fulfillment"
export * from "./inventory"
export * from "./order"
export * from "./pricing"
export * from "./product-category"
export * from "./promotion"
export * from "./sales-channel"
export * from "./stock-locations"
export * from "./tax"
@@ -0,0 +1,3 @@
export * from "./promotion-rule"
export * from "./rule-attribute-options"
export * from "./rule-operator-options"
@@ -0,0 +1,21 @@
/**
* @experimental
*/
export interface PromotionRuleResponse {
id: string
attribute: string
attribute_label: string
field_type: string
operator: string
operator_label: string
values: { value: string }[]
disguised: boolean
required: boolean
}
/**
* @experimental
*/
export interface AdminPromotionRuleListResponse {
attributes: PromotionRuleResponse[]
}
@@ -0,0 +1,18 @@
/**
* @experimental
*/
export interface RuleAttributeOptionsResponse {
id: string
value: string
label: string
field_type: string
required: boolean
disguised: boolean
}
/**
* @experimental
*/
export interface AdminRuleAttributeOptionsListResponse {
attributes: RuleAttributeOptionsResponse[]
}
@@ -0,0 +1,15 @@
/**
* @experimental
*/
export interface RuleOperatorOptionsResponse {
id: string
value: string
label: string
}
/**
* @experimental
*/
export interface AdminRuleOperatorOptionsListResponse {
operators: RuleOperatorOptionsResponse[]
}
@@ -0,0 +1 @@
export * from "./admin"
+2 -1
View File
@@ -2,9 +2,10 @@ export type AdminGetPromotionRulesRes = {
id?: string
attribute: string
attribute_label: string
field_type?: string
operator: string
operator_label: string
values: { label?: string; value: string }[]
values: { label?: string; value?: string }[]
disguised?: boolean
required?: boolean
}[]