instantPurchaseConfig = $instantPurchaseConfig; } /** * Checks if button enabled. * * @return bool * @since 100.2.0 */ public function isEnabled(): bool { return $this->instantPurchaseConfig->isModuleEnabled($this->getCurrentStoreId()); } /** * @inheritdoc * @since 100.2.0 */ public function getJsLayout(): string { $buttonText = $this->instantPurchaseConfig->getButtonText($this->getCurrentStoreId()); $purchaseUrl = $this->getUrl('instantpurchase/button/placeOrder', ['_secure' => true]); // String data does not require escaping here and handled on transport level and on client side $this->jsLayout['components']['instant-purchase']['config']['buttonText'] = $buttonText; $this->jsLayout['components']['instant-purchase']['config']['purchaseUrl'] = $purchaseUrl; return parent::getJsLayout(); } /** * Returns active store view identifier. * * @return int */ private function getCurrentStoreId(): int { return $this->_storeManager->getStore()->getId(); } }