UNPKG

@medusajs/core-flows

Version:

Set of workflow definitions for Medusa

66 lines 3.39 kB
import { AdditionalData, CreateCustomerAddressDTO } from "@medusajs/framework/types"; import { WorkflowData } from "@medusajs/framework/workflows-sdk"; /** * The data to create one or more customer addresses, along with custom data that's passed to the workflow's hooks. */ export type CreateCustomerAddressesWorkflowInput = { /** * The addresses to create. */ addresses: CreateCustomerAddressDTO[]; } & AdditionalData; export declare const createCustomerAddressesWorkflowId = "create-customer-addresses"; /** * This workflow creates one or more addresses for customers. It's used by the [Add Customer Address Admin API Route](https://docs.medusajs.com/api/admin#customers_postcustomersidaddresses) * and the [Add Customer Address Store API Route](https://docs.medusajs.com/api/store#customers_postcustomersmeaddresses). * * This workflow has a hook that allows you to perform custom actions on the created customer addresses. For example, you can pass under `additional_data` custom data that * allows you to create custom data models linked to the addresses. * * You can also use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around creating customer addresses. * * @example * const { result } = await createCustomerAddressesWorkflow(container) * .run({ * input: { * addresses: [ * { * customer_id: "cus_123", * address_1: "456 Elm St", * city: "Los Angeles", * country_code: "us", * postal_code: "90001", * first_name: "Jane", * last_name: "Smith", * }, * { * customer_id: "cus_321", * address_1: "789 Oak St", * city: "New York", * country_code: "us", * postal_code: "10001", * first_name: "Alice", * last_name: "Johnson", * } * ], * additional_data: { * crm_id: "123" * } * } * }) * * @summary * * Create one or more customer addresses. * * @property hooks.addressesCreated - This hook is executed after the addresses are created. You can consume this hook to perform custom actions on the created addresses. */ export declare const createCustomerAddressesWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateCustomerAddressesWorkflowInput, import("@medusajs/framework/types").CustomerAddressDTO[], [import("@medusajs/framework/workflows-sdk").Hook<"addressesCreated", { addresses: (import("@medusajs/framework/types").CustomerAddressDTO | WorkflowData<import("@medusajs/framework/types").CustomerAddressDTO>)[] & import("@medusajs/framework/types").CustomerAddressDTO[] & import("@medusajs/framework/workflows-sdk").WorkflowDataProperties<import("@medusajs/framework/types").CustomerAddressDTO[]> & { config(config: { name?: string; } & Omit<import("@medusajs/orchestration").TransactionStepsDefinition, "next" | "uuid" | "action">): WorkflowData<import("@medusajs/framework/types").CustomerAddressDTO[]>; } & import("@medusajs/framework/workflows-sdk").StepFunctionReturnConfig<import("@medusajs/framework/types").CustomerAddressDTO[]>; additional_data: ((Record<string, unknown> | WorkflowData<Record<string, unknown> | undefined>) & Record<string, unknown>) | undefined; }, unknown>]>; //# sourceMappingURL=create-addresses.d.ts.map