UNPKG

@medusajs/core-flows

Version:

Set of workflow definitions for Medusa

57 lines 2.89 kB
import { AdditionalData, CreateCampaignDTO } from "@medusajs/framework/types"; import { WorkflowData } from "@medusajs/framework/workflows-sdk"; /** * The data to create one or more campaigns, along with custom data that's passed to the workflow's hooks. */ export type CreateCampaignsWorkflowInput = { /** * The campaigns to create. */ campaignsData: CreateCampaignDTO[]; } & AdditionalData; export declare const createCampaignsWorkflowId = "create-campaigns"; /** * This workflow creates one or more campaigns. It's used by the [Create Campaign Admin API Route](https://docs.medusajs.com/api/admin#campaigns_postcampaigns). * * This workflow has a hook that allows you to perform custom actions on the created campaigns. For example, you can pass under `additional_data` custom data that * allows you to create custom data models linked to the campaigns. * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around creating campaigns. * * @example * const { result } = await createCampaignsWorkflow(container) * .run({ * input: { * campaignsData: [ * { * name: "Launch Promotions", * campaign_identifier: "GA-123456", * starts_at: new Date("2025-01-01"), * ends_at: new Date("2026-01-01"), * budget: { * type: "usage", * limit: 100, * } * } * ], * additional_data: { * target_audience: "new_customers" * } * } * }) * * @summary * * Create one or more campaigns. * * @property hooks.campaignsCreated - This hook is executed after the campaigns are created. You can consume this hook to perform custom actions on the created campaigns. */ export declare const createCampaignsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateCampaignsWorkflowInput, import("@medusajs/framework/types").CampaignDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"campaignsCreated", { campaigns: (import("@medusajs/framework/types").CampaignDTO | WorkflowData<import("@medusajs/framework/types").CampaignDTO>)[] & import("@medusajs/framework/types").CampaignDTO[] & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<import("@medusajs/framework/types").CampaignDTO[]> & { config(config: { name?: string; } & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<import("@medusajs/framework/types").CampaignDTO[]>; } & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<import("@medusajs/framework/types").CampaignDTO[]>; additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined; }, unknown>]>; //# sourceMappingURL=create-campaigns.d.ts.map