From 16874164138e6332af0960b59faafc04ec60ffd3 Mon Sep 17 00:00:00 2001 From: Nima Date: Tue, 3 Jan 2023 14:54:03 +0000 Subject: [PATCH] Add MarketingCampaignType class This allows defining campaign types for each marketing channel. --- .../Admin/Marketing/MarketingCampaignType.php | 130 ++++++++++++++++++ .../Marketing/MarketingChannelInterface.php | 7 + 2 files changed, 137 insertions(+) create mode 100644 plugins/woocommerce/src/Admin/Marketing/MarketingCampaignType.php diff --git a/plugins/woocommerce/src/Admin/Marketing/MarketingCampaignType.php b/plugins/woocommerce/src/Admin/Marketing/MarketingCampaignType.php new file mode 100644 index 00000000000..032dc6f249d --- /dev/null +++ b/plugins/woocommerce/src/Admin/Marketing/MarketingCampaignType.php @@ -0,0 +1,130 @@ +id = $id; + $this->channel = $channel; + $this->name = $name; + $this->description = $description; + $this->create_url = $create_url; + $this->icon_url = $icon_url; + } + + /** + * Returns the marketing campaign's unique identifier. + * + * @return string + */ + public function get_id(): string { + return $this->id; + } + + /** + * Returns the marketing channel that this campaign type belongs to. + * + * @return MarketingChannelInterface + */ + public function get_channel(): MarketingChannelInterface { + return $this->channel; + } + + /** + * Returns the name of the marketing campaign type. + * + * @return string + */ + public function get_name(): string { + return $this->name; + } + + /** + * Returns the description of the marketing campaign type. + * + * @return string + */ + public function get_description(): string { + return $this->description; + } + + /** + * Returns the URL to the create campaign page. + * + * @return string + */ + public function get_create_url(): string { + return $this->create_url; + } + + /** + * Returns the URL to an image/icon for the campaign type. + * + * @return string + */ + public function get_icon_url(): string { + return $this->icon_url; + } +} diff --git a/plugins/woocommerce/src/Admin/Marketing/MarketingChannelInterface.php b/plugins/woocommerce/src/Admin/Marketing/MarketingChannelInterface.php index b2dbc3819a2..6794c4b4259 100644 --- a/plugins/woocommerce/src/Admin/Marketing/MarketingChannelInterface.php +++ b/plugins/woocommerce/src/Admin/Marketing/MarketingChannelInterface.php @@ -73,6 +73,13 @@ interface MarketingChannelInterface { */ public function get_errors_count(): int; + /** + * Returns an array of marketing campaign types that the channel supports. + * + * @return MarketingCampaignType[] Array of marketing campaign type objects. + */ + public function get_supported_campaign_types(): array; + /** * Returns an array of the channel's marketing campaigns. *