| 1 |
<?php |
| 2 |
/** |
| 3 |
* Widgets Service Interface |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @subpackage SeQura/WC/Services |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SeQura\WC\Services\Widgets; |
| 10 |
|
| 11 |
/** |
| 12 |
* Widgets Service Interface |
| 13 |
* |
| 14 |
* @phpstan-type WidgetDataArray array{ |
| 15 |
* product: string, |
| 16 |
* dest: string, |
| 17 |
* theme: string, |
| 18 |
* reverse: string, |
| 19 |
* campaign: string, |
| 20 |
* priceSel: string, |
| 21 |
* altPriceSel: string, |
| 22 |
* altTriggerSelector: string, |
| 23 |
* minAmount: int, |
| 24 |
* maxAmount: int, |
| 25 |
* miniWidgetMessage: string, |
| 26 |
* miniWidgetBelowLimitMessage: string |
| 27 |
* } |
| 28 |
* |
| 29 |
* @phpstan-type WidgetConfigParamsDataArray array{ |
| 30 |
* assetKey: string, |
| 31 |
* merchantId: string, |
| 32 |
* products: string[], |
| 33 |
* scriptUri: string, |
| 34 |
* locale: string, |
| 35 |
* currency: string, |
| 36 |
* decimalSeparator: string, |
| 37 |
* thousandSeparator: string, |
| 38 |
* isProductListingEnabled: bool, |
| 39 |
* isProductEnabled: bool, |
| 40 |
* widgetConfig: string |
| 41 |
* } |
| 42 |
*/ |
| 43 |
interface Interface_Widgets_Service { |
| 44 |
|
| 45 |
/** |
| 46 |
* Get available widget for cart page |
| 47 |
* |
| 48 |
* @return WidgetDataArray|null The available widget, or null if cannot be determined |
| 49 |
*/ |
| 50 |
public function get_widget_for_cart_page(): ?array; |
| 51 |
|
| 52 |
/** |
| 53 |
* Get available widget for product listing page |
| 54 |
* |
| 55 |
* @return WidgetDataArray|null The available widget, or null if cannot be determined |
| 56 |
*/ |
| 57 |
public function get_widget_for_product_listing_page(): ?array; |
| 58 |
|
| 59 |
/** |
| 60 |
* Get available widgets for product page |
| 61 |
* |
| 62 |
* @return WidgetDataArray[]|null The available widgets, or null if cannot be determined |
| 63 |
*/ |
| 64 |
public function get_widgets_for_product_page( string $product_id ): ?array; |
| 65 |
|
| 66 |
/** |
| 67 |
* Get widget configuration parameters required in the frontend |
| 68 |
* |
| 69 |
* @return WidgetConfigParamsDataArray|null The configuration parameters, or null if cannot be determined |
| 70 |
*/ |
| 71 |
public function get_widget_config_params(): ?array; |
| 72 |
} |
| 73 |
|