From 90b44450d2bb5becd5a6597813ee199c8d303bf3 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Mon, 12 Aug 2019 22:04:08 -0500 Subject: [PATCH] magento/adobe-stock-integration#341: Extracted AdobeIms and AdobeImsApi modules --- .travis.yml | 2 + .../Controller/Adminhtml/OAuth/Callback.php | 20 ++-- AdobeIms/Model/Config.php | 107 ++++++++++++++++++ AdobeIms/Model/Config/ImsToken.php | 71 ------------ AdobeIms/Model/GetToken.php | 96 ++++++++++++++++ .../Model/OAuth/TokenResponse.php | 5 +- .../Model/ResourceModel/UserProfile.php | 4 +- .../ResourceModel/UserProfile/Collection.php | 6 +- .../Model/UserProfile.php | 8 +- .../Model/UserProfileRepository.php | 8 +- AdobeIms/README.md | 2 +- AdobeIms/Test/Unit/Model/ConfigTest.php | 65 +++++++++++ AdobeIms/composer.json | 9 +- AdobeIms/etc/config.xml | 19 ++++ AdobeIms/etc/db_schema.xml | 6 +- AdobeIms/etc/db_schema_whitelist.json | 6 +- AdobeIms/etc/di.xml | 14 +++ .../adminhtml/web/js/action/authorization.js | 2 +- AdobeImsApi/Api/Data/ConfigInterface.php | 51 +++++++++ .../Api/Data/TokenResponseInterface.php | 86 ++++++++++++++ .../Api/Data/UserProfileInterface.php | 6 +- AdobeImsApi/Api/GetTokenInterface.php | 28 +++++ .../Api/UserProfileRepositoryInterface.php | 14 +-- AdobeImsApi/LICENSE.txt | 48 ++++++++ AdobeImsApi/LICENSE_AFL.txt | 48 ++++++++ AdobeImsApi/README.md | 16 +++ AdobeImsApi/composer.json | 21 ++++ AdobeImsApi/etc/module.xml | 10 ++ AdobeImsApi/modman | 1 + AdobeImsApi/registration.php | 9 ++ .../System/Config/TestConnection.php | 4 +- .../Model/System/Config/Comment.php | 11 +- AdobeStockAdminUi/etc/adminhtml/system.xml | 4 +- .../templates/system/config/connection.phtml | 2 +- .../view/adminhtml/web/js/connection.js | 2 +- AdobeStockAsset/etc/di.xml | 3 - AdobeStockClient/Model/Client.php | 92 ++++----------- AdobeStockClient/Model/Config.php | 58 ---------- .../SearchParametersProvider/MediaId.php | 3 +- .../Test/Unit/Model/ConfigTest.php | 11 -- .../SearchParametersProviderCompositeTest.php | 6 +- AdobeStockClient/etc/config.xml | 4 - AdobeStockClientApi/Api/ClientInterface.php | 13 +-- .../Api/Data/ConfigInterface.php | 34 ------ .../Listing/Columns/ImagePreview.php | 6 +- AdobeStockImageAdminUi/composer.json | 4 +- .../components/grid/column/image-preview.js | 7 +- _metapackage/composer.json | 3 +- modman | 2 + 49 files changed, 715 insertions(+), 342 deletions(-) create mode 100644 AdobeIms/Model/Config.php delete mode 100644 AdobeIms/Model/Config/ImsToken.php create mode 100644 AdobeIms/Model/GetToken.php rename {AdobeStockClient => AdobeIms}/Model/OAuth/TokenResponse.php (91%) rename {AdobeStockAsset => AdobeIms}/Model/ResourceModel/UserProfile.php (75%) rename {AdobeStockAsset => AdobeIms}/Model/ResourceModel/UserProfile/Collection.php (67%) rename {AdobeStockAsset => AdobeIms}/Model/UserProfile.php (93%) rename {AdobeStockAsset => AdobeIms}/Model/UserProfileRepository.php (90%) create mode 100644 AdobeIms/Test/Unit/Model/ConfigTest.php create mode 100644 AdobeIms/etc/config.xml create mode 100644 AdobeIms/etc/di.xml create mode 100644 AdobeImsApi/Api/Data/ConfigInterface.php create mode 100644 AdobeImsApi/Api/Data/TokenResponseInterface.php rename {AdobeStockAssetApi => AdobeImsApi}/Api/Data/UserProfileInterface.php (94%) create mode 100644 AdobeImsApi/Api/GetTokenInterface.php rename {AdobeStockAssetApi => AdobeImsApi}/Api/UserProfileRepositoryInterface.php (53%) create mode 100644 AdobeImsApi/LICENSE.txt create mode 100644 AdobeImsApi/LICENSE_AFL.txt create mode 100644 AdobeImsApi/README.md create mode 100644 AdobeImsApi/composer.json create mode 100644 AdobeImsApi/etc/module.xml create mode 100644 AdobeImsApi/modman create mode 100644 AdobeImsApi/registration.php rename AdobeStockAdminUi/{Model => }/Block/Adminhtml/System/Config/TestConnection.php (94%) rename {AdobeStockAsset => AdobeStockAdminUi}/Model/System/Config/Comment.php (87%) diff --git a/.travis.yml b/.travis.yml index a77d9c1aa9f0..ea908a2b6683 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ before_script: env: matrix: - TEST_CATEGORY=static + - TEST_CATEGORY=unit_ims - TEST_CATEGORY=unit_client - TEST_CATEGORY=unit_image - TEST_CATEGORY=unit_ui @@ -24,6 +25,7 @@ env: matrix: fast_finish: true script: + - if [ $TEST_CATEGORY == 'unit_ims' ]; then vendor/bin/phpunit --configuration dev/tests/unit/phpunit.xml.dist vendor/magento/module-adobe-stock-ims/Test/Unit; fi - if [ $TEST_CATEGORY == 'unit_client' ]; then vendor/bin/phpunit --configuration dev/tests/unit/phpunit.xml.dist vendor/magento/module-adobe-stock-client/Test/Unit; fi - if [ $TEST_CATEGORY == 'unit_ui' ]; then vendor/bin/phpunit --configuration dev/tests/unit/phpunit.xml.dist vendor/magento/module-adobe-stock-admin-ui/Test/Unit; fi - if [ $TEST_CATEGORY == 'unit_image' ]; then vendor/bin/phpunit --configuration dev/tests/unit/phpunit.xml.dist vendor/magento/module-adobe-stock-image/Test/Unit; fi diff --git a/AdobeIms/Controller/Adminhtml/OAuth/Callback.php b/AdobeIms/Controller/Adminhtml/OAuth/Callback.php index 609cae3ef905..c433eaa8aa67 100644 --- a/AdobeIms/Controller/Adminhtml/OAuth/Callback.php +++ b/AdobeIms/Controller/Adminhtml/OAuth/Callback.php @@ -11,10 +11,10 @@ use DateInterval; use DateTime; use Exception; -use Magento\AdobeStockAssetApi\Api\Data\UserProfileInterface; -use Magento\AdobeStockAssetApi\Api\Data\UserProfileInterfaceFactory; -use Magento\AdobeStockAssetApi\Api\UserProfileRepositoryInterface; -use Magento\AdobeStockClientApi\Api\ClientInterface; +use Magento\AdobeImsApi\Api\Data\UserProfileInterface; +use Magento\AdobeImsApi\Api\Data\UserProfileInterfaceFactory; +use Magento\AdobeImsApi\Api\GetTokenInterface; +use Magento\AdobeImsApi\Api\UserProfileRepositoryInterface; use Magento\Backend\App\Action; use Magento\Framework\Controller\Result\Raw; use Magento\Framework\Controller\ResultFactory; @@ -60,9 +60,9 @@ class Callback extends Action private $userProfileFactory; /** - * @var ClientInterface + * @var GetTokenInterface */ - private $client; + private $getToken; /** * @var LoggerInterface @@ -74,21 +74,21 @@ class Callback extends Action * @param Action\Context $context * @param UserProfileRepositoryInterface $userProfileRepository * @param UserProfileInterfaceFactory $userProfileFactory - * @param ClientInterface $client + * @param GetTokenInterface $getToken * @param LoggerInterface $logger */ public function __construct( Action\Context $context, UserProfileRepositoryInterface $userProfileRepository, UserProfileInterfaceFactory $userProfileFactory, - ClientInterface $client, + GetTokenInterface $getToken, LoggerInterface $logger ) { parent::__construct($context); $this->userProfileRepository = $userProfileRepository; $this->userProfileFactory = $userProfileFactory; - $this->client = $client; + $this->getToken = $getToken; $this->logger = $logger; } @@ -98,7 +98,7 @@ public function __construct( public function execute() : \Magento\Framework\Controller\ResultInterface { try { - $tokenResponse = $this->client->getToken( + $tokenResponse = $this->getToken->execute( (string)$this->getRequest()->getParam('code') ); diff --git a/AdobeIms/Model/Config.php b/AdobeIms/Model/Config.php new file mode 100644 index 000000000000..e8ccf8902688 --- /dev/null +++ b/AdobeIms/Model/Config.php @@ -0,0 +1,107 @@ +scopeConfig = $scopeConfig; + $this->url = $url; + } + + /** + * Retrieve integration API key (Client ID) + * + * @return string|null + */ + public function getApiKey():? string + { + return $this->scopeConfig->getValue(self::XML_PATH_API_KEY); + } + + /** + * @inheritdoc + */ + public function getPrivateKey(): string + { + return (string)$this->scopeConfig->getValue(self::XML_PATH_PRIVATE_KEY); + } + + /** + * @inheritdoc + */ + public function getTokenUrl(): string + { + return $this->scopeConfig->getValue(self::XML_PATH_TOKEN_URL); + } + + /** + * @inheritdoc + */ + public function getAuthUrl(): string + { + return str_replace( + ['#{client_id}', '#{redirect_uri}', '#{locale}'], + [$this->getApiKey(), $this->getCallBackUrl(), $this->getLocale()], + $this->scopeConfig->getValue(self::XML_PATH_AUTH_URL_PATTERN) + ); + } + + /** + * Retrieve Callback URL + * + * @return string + */ + public function getCallBackUrl(): string + { + return $this->url->getUrl('adobe_ims/oauth/callback'); + } + + + /** + * Retrieve token URL + * + * @return string + */ + private function getLocale(): string + { + return $this->scopeConfig->getValue(Custom::XML_PATH_GENERAL_LOCALE_CODE); + } +} diff --git a/AdobeIms/Model/Config/ImsToken.php b/AdobeIms/Model/Config/ImsToken.php deleted file mode 100644 index 61f1bcbc6a2b..000000000000 --- a/AdobeIms/Model/Config/ImsToken.php +++ /dev/null @@ -1,71 +0,0 @@ -apiKey = $apiKey; - $this->privateKey = $privateKey; - $this->execute(); - } - - /** - * @throws \Exception - */ - private function execute() - { - - //TODO Access token get implementation - } - - /** - * Return access token. - * - * @return string - * @throws \Exception - */ - public function getAccessToken() - { - if ($this->accessToken !== '') { - return $this->accessToken; - } - } -} diff --git a/AdobeIms/Model/GetToken.php b/AdobeIms/Model/GetToken.php new file mode 100644 index 000000000000..da5d4bafc8d0 --- /dev/null +++ b/AdobeIms/Model/GetToken.php @@ -0,0 +1,96 @@ +config = $config; + $this->curlFactory = $curlFactory; + $this->json = $json; + $this->tokenResponseFactory = $tokenResponseFactory; + } + + /** + * @inheritdoc + */ + public function execute(string $code): TokenResponseInterface + { + $curl = $this->curlFactory->create(); + + $curl->addHeader('Content-Type', 'application/x-www-form-urlencoded'); + $curl->addHeader('cache-control', 'no-cache'); + + $curl->post( + $this->config->getTokenUrl(), + [ + 'client_id' => $this->config->getApiKey(), + 'client_secret' => $this->config->getPrivateKey(), + 'code' => $code, + 'grant_type' => 'authorization_code' + ] + ); + + $tokenResponse = $this->json->unserialize($curl->getBody()); + /** @var TokenResponse $tokenResponse */ + $tokenResponse = $this->tokenResponseFactory->create() + ->addData(is_array($tokenResponse) ? $tokenResponse : ['error' => __('The response is empty.')]); + + if (empty($tokenResponse->getAccessToken()) || empty($tokenResponse->getRefreshToken())) { + throw new AuthorizationException( + __('Authentication is failing. Error code: %1', $tokenResponse->getError()) + ); + } + + return $tokenResponse; + } +} diff --git a/AdobeStockClient/Model/OAuth/TokenResponse.php b/AdobeIms/Model/OAuth/TokenResponse.php similarity index 91% rename from AdobeStockClient/Model/OAuth/TokenResponse.php rename to AdobeIms/Model/OAuth/TokenResponse.php index fb6ba63b3f9e..6247fa9025f8 100644 --- a/AdobeStockClient/Model/OAuth/TokenResponse.php +++ b/AdobeIms/Model/OAuth/TokenResponse.php @@ -6,14 +6,15 @@ declare(strict_types=1); -namespace Magento\AdobeStockClient\Model\OAuth; +namespace Magento\AdobeIms\Model\OAuth; +use Magento\AdobeImsApi\Api\Data\TokenResponseInterface; use Magento\Framework\DataObject; /** * Class TokenResponse */ -class TokenResponse extends DataObject +class TokenResponse extends DataObject implements TokenResponseInterface { /** * Get access token diff --git a/AdobeStockAsset/Model/ResourceModel/UserProfile.php b/AdobeIms/Model/ResourceModel/UserProfile.php similarity index 75% rename from AdobeStockAsset/Model/ResourceModel/UserProfile.php rename to AdobeIms/Model/ResourceModel/UserProfile.php index 0d9f501b6f82..00134f1ffb30 100644 --- a/AdobeStockAsset/Model/ResourceModel/UserProfile.php +++ b/AdobeIms/Model/ResourceModel/UserProfile.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace Magento\AdobeStockAsset\Model\ResourceModel; +namespace Magento\AdobeIms\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; @@ -20,6 +20,6 @@ class UserProfile extends AbstractDb */ protected function _construct() { - $this->_init('adobe_stock_user_profile', 'id'); + $this->_init('adobe_user_profile', 'id'); } } diff --git a/AdobeStockAsset/Model/ResourceModel/UserProfile/Collection.php b/AdobeIms/Model/ResourceModel/UserProfile/Collection.php similarity index 67% rename from AdobeStockAsset/Model/ResourceModel/UserProfile/Collection.php rename to AdobeIms/Model/ResourceModel/UserProfile/Collection.php index 5b007cf38328..dcf31559b7b3 100644 --- a/AdobeStockAsset/Model/ResourceModel/UserProfile/Collection.php +++ b/AdobeIms/Model/ResourceModel/UserProfile/Collection.php @@ -6,10 +6,10 @@ declare(strict_types=1); -namespace Magento\AdobeStockAsset\Model\ResourceModel\UserProfile; +namespace Magento\AdobeIms\Model\ResourceModel\UserProfile; -use Magento\AdobeStockAsset\Model\ResourceModel\UserProfile as UserProfileResource; -use Magento\AdobeStockAsset\Model\UserProfile as UserProfileModel; +use Magento\AdobeIms\Model\ResourceModel\UserProfile as UserProfileResource; +use Magento\AdobeIms\Model\UserProfile as UserProfileModel; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; /** diff --git a/AdobeStockAsset/Model/UserProfile.php b/AdobeIms/Model/UserProfile.php similarity index 93% rename from AdobeStockAsset/Model/UserProfile.php rename to AdobeIms/Model/UserProfile.php index 6568fe8c44b1..020febf18d60 100644 --- a/AdobeStockAsset/Model/UserProfile.php +++ b/AdobeIms/Model/UserProfile.php @@ -6,12 +6,12 @@ declare(strict_types=1); -namespace Magento\AdobeStockAsset\Model; +namespace Magento\AdobeIms\Model; -use Magento\AdobeStockAsset\Model\ResourceModel\UserProfile as UserProfileResource; -use Magento\AdobeStockAssetApi\Api\Data\UserProfileInterface; +use Magento\AdobeIms\Model\ResourceModel\UserProfile as UserProfileResource; +use Magento\AdobeImsApi\Api\Data\UserProfileInterface; use Magento\Framework\Model\AbstractExtensibleModel; -use Magento\AdobeStockAssetApi\Api\Data\UserProfileExtensionInterface; +use Magento\AdobeImsApi\Api\Data\UserProfileExtensionInterface; /** * Class UserProfile diff --git a/AdobeStockAsset/Model/UserProfileRepository.php b/AdobeIms/Model/UserProfileRepository.php similarity index 90% rename from AdobeStockAsset/Model/UserProfileRepository.php rename to AdobeIms/Model/UserProfileRepository.php index 740574b0f5b2..1cb22d134f88 100644 --- a/AdobeStockAsset/Model/UserProfileRepository.php +++ b/AdobeIms/Model/UserProfileRepository.php @@ -6,12 +6,12 @@ declare(strict_types=1); -namespace Magento\AdobeStockAsset\Model; +namespace Magento\AdobeIms\Model; use Exception; -use Magento\AdobeStockAssetApi\Api\Data\UserProfileInterface; -use Magento\AdobeStockAssetApi\Api\Data\UserProfileInterfaceFactory; -use Magento\AdobeStockAssetApi\Api\UserProfileRepositoryInterface; +use Magento\AdobeImsApi\Api\Data\UserProfileInterface; +use Magento\AdobeImsApi\Api\Data\UserProfileInterfaceFactory; +use Magento\AdobeImsApi\Api\UserProfileRepositoryInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; diff --git a/AdobeIms/README.md b/AdobeIms/README.md index 603927b0f6f6..a4cd493b05aa 100644 --- a/AdobeIms/README.md +++ b/AdobeIms/README.md @@ -1,4 +1,4 @@ -# Magento_AdobeStockAsset Module +# Magento_AdobeIms Module ## Structure diff --git a/AdobeIms/Test/Unit/Model/ConfigTest.php b/AdobeIms/Test/Unit/Model/ConfigTest.php new file mode 100644 index 000000000000..458a25ba41eb --- /dev/null +++ b/AdobeIms/Test/Unit/Model/ConfigTest.php @@ -0,0 +1,65 @@ +objectManager = new ObjectManager($this); + $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->setMethods(['getValue']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->config = $this->objectManager->getObject( + Config::class, + [ + 'scopeConfig' => $this->scopeConfigMock + ] + ); + } + + /** + * Get API key test. + */ + public function testGetApiKey(): void + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(self::CONFIG_XML_PATH_API_KEY); + $this->config->getApiKey(); + } +} diff --git a/AdobeIms/composer.json b/AdobeIms/composer.json index cbc0b9113d7b..0d0b017d62d8 100644 --- a/AdobeIms/composer.json +++ b/AdobeIms/composer.json @@ -5,8 +5,7 @@ "php": "~7.1.3||~7.2.0", "magento/framework": "*", "magento/module-user": "*", - "magento/module-adobe-stock-asset-api": "*", - "magento/module-adobe-stock-client-api": "*" + "magento/module-adobe-ims-api": "*" }, "type": "magento2-module", "license": [ @@ -20,11 +19,5 @@ "psr-4": { "Magento\\AdobeIms\\": "" } - }, - "repositories": { - "stock-api-libphp": { - "type": "vcs", - "url": "git@github.com:adobe/stock-api-libphp.git" - } } } diff --git a/AdobeIms/etc/config.xml b/AdobeIms/etc/config.xml new file mode 100644 index 000000000000..ce320acd623e --- /dev/null +++ b/AdobeIms/etc/config.xml @@ -0,0 +1,19 @@ + + + + + + + + + https://ims-na1.adobelogin.com/ims/token + + + + + diff --git a/AdobeIms/etc/db_schema.xml b/AdobeIms/etc/db_schema.xml index 41fa71cb8bb0..291539666a80 100644 --- a/AdobeIms/etc/db_schema.xml +++ b/AdobeIms/etc/db_schema.xml @@ -6,7 +6,7 @@ */ --> - +
@@ -17,12 +17,12 @@ - + - +
diff --git a/AdobeIms/etc/db_schema_whitelist.json b/AdobeIms/etc/db_schema_whitelist.json index 4e7725886e44..6aab299e9748 100644 --- a/AdobeIms/etc/db_schema_whitelist.json +++ b/AdobeIms/etc/db_schema_whitelist.json @@ -1,5 +1,5 @@ { - "adobe_stock_user_profile": { + "adobe_user_profile": { "column": { "id": true, "adobe_id": true, @@ -12,11 +12,11 @@ "updated_at": true }, "index": { - "ADOBE_STOCK_USER_PROFILE_ID": true + "ADOBE_USER_PROFILE_ID": true }, "constraint": { "PRIMARY": true, - "ADOBE_STOCK_USER_PROFILE_ADMIN_USER_ID_ADMIN_USER_USER_ID": true + "ADOBE_USER_PROFILE_ADMIN_USER_ID_ADMIN_USER_USER_ID": true } } } diff --git a/AdobeIms/etc/di.xml b/AdobeIms/etc/di.xml new file mode 100644 index 000000000000..76a2232d9302 --- /dev/null +++ b/AdobeIms/etc/di.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/AdobeIms/view/adminhtml/web/js/action/authorization.js b/AdobeIms/view/adminhtml/web/js/action/authorization.js index 4f4cebdfbc86..e16ceed026ee 100644 --- a/AdobeIms/view/adminhtml/web/js/action/authorization.js +++ b/AdobeIms/view/adminhtml/web/js/action/authorization.js @@ -83,7 +83,7 @@ define([], function () { reject(new Error('Time\'s up.')); }, authConfig.stopHandleTimeout || 10000); - responseData = authWindow.document.body.innerText.match(authConfig.response.regexpPattern) + responseData = authWindow.document.body.innerText.match(authConfig.response.regexpPattern); if (responseData) { stopHandle(); diff --git a/AdobeImsApi/Api/Data/ConfigInterface.php b/AdobeImsApi/Api/Data/ConfigInterface.php new file mode 100644 index 000000000000..2148f398e0e5 --- /dev/null +++ b/AdobeImsApi/Api/Data/ConfigInterface.php @@ -0,0 +1,51 @@ +" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/AdobeImsApi/LICENSE_AFL.txt b/AdobeImsApi/LICENSE_AFL.txt new file mode 100644 index 000000000000..f39d641b18a1 --- /dev/null +++ b/AdobeImsApi/LICENSE_AFL.txt @@ -0,0 +1,48 @@ + +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/AdobeImsApi/README.md b/AdobeImsApi/README.md new file mode 100644 index 000000000000..df0329c2510e --- /dev/null +++ b/AdobeImsApi/README.md @@ -0,0 +1,16 @@ +# Magento_AdobeImsApi Module + +The Magento_AdobeImsApi module responsible for authentication to adobe services + +## Structure + +Beyond the [usual module file structure](https://devdocs.magento.com/guides/v2.2/architecture/archi_perspectives/components/modules/mod_intro.html) the module contains a directory `ReportXml`. +[Report XML](https://devdocs.magento.com/guides/v2.2/advanced-reporting/report-xml.html) is a markup language used to build reports for Advanced Reporting. +The language declares SQL queries using XML declaration. + +## Subscription Process + +## Analytics Settings + +## Extensibility + diff --git a/AdobeImsApi/composer.json b/AdobeImsApi/composer.json new file mode 100644 index 000000000000..77d9d65596cd --- /dev/null +++ b/AdobeImsApi/composer.json @@ -0,0 +1,21 @@ +{ + "name": "magento/module-adobe-ims-api", + "description": "N/A", + "require": { + "php": "~7.1.3||~7.2.0", + "magento/framework": "*" + }, + "type": "magento2-module", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\AdobeImsApi\\": "" + } + } +} diff --git a/AdobeImsApi/etc/module.xml b/AdobeImsApi/etc/module.xml new file mode 100644 index 000000000000..2ec4c518b9ec --- /dev/null +++ b/AdobeImsApi/etc/module.xml @@ -0,0 +1,10 @@ + + + + + diff --git a/AdobeImsApi/modman b/AdobeImsApi/modman new file mode 100644 index 000000000000..61765245b272 --- /dev/null +++ b/AdobeImsApi/modman @@ -0,0 +1 @@ +./ app/code/Magento/AdobeImsApi \ No newline at end of file diff --git a/AdobeImsApi/registration.php b/AdobeImsApi/registration.php new file mode 100644 index 000000000000..a2a3a105cdab --- /dev/null +++ b/AdobeImsApi/registration.php @@ -0,0 +1,9 @@ + 'Adobe.io',] + ['io_link' => 'Adobe.io'] ); $notes = __( @@ -75,9 +76,7 @@ public function getCommentText($elementValue): string private function getRedirectUrl(): string { $adminRoteUrl = $this->url->getRouteUrl('admin'); - $indexPhpToUrl = $this->scopeConfig->isSetFlag(\Magento\Store\Model\Store::XML_PATH_USE_REWRITES) ? - '' - : 'index.php/'; + $indexPhpToUrl = $this->scopeConfig->isSetFlag(Store::XML_PATH_USE_REWRITES) ? '' : 'index.php/'; $redirectUrl = $adminRoteUrl . $indexPhpToUrl . self::REDIRECT_MCA; return $redirectUrl; diff --git a/AdobeStockAdminUi/etc/adminhtml/system.xml b/AdobeStockAdminUi/etc/adminhtml/system.xml index 27c3b8239a36..8f457989078f 100644 --- a/AdobeStockAdminUi/etc/adminhtml/system.xml +++ b/AdobeStockAdminUi/etc/adminhtml/system.xml @@ -28,7 +28,7 @@ - + adobe_stock/integration/private_key required-entry Magento\Config\Model\Config\Backend\Encrypted diff --git a/AdobeStockAdminUi/view/adminhtml/templates/system/config/connection.phtml b/AdobeStockAdminUi/view/adminhtml/templates/system/config/connection.phtml index 76eccd56f854..2724b3a43fd4 100644 --- a/AdobeStockAdminUi/view/adminhtml/templates/system/config/connection.phtml +++ b/AdobeStockAdminUi/view/adminhtml/templates/system/config/connection.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $block \Magento\AdobeStockAdminUi\Model\Block\Adminhtml\System\Config\TestConnection */ +/** @var $block \Magento\AdobeStockAdminUi\Block\Adminhtml\System\Config\TestConnection */ ?>
diff --git a/AdobeStockAdminUi/view/adminhtml/web/js/connection.js b/AdobeStockAdminUi/view/adminhtml/web/js/connection.js index 0f7d86a13cb7..d60940546e0a 100644 --- a/AdobeStockAdminUi/view/adminhtml/web/js/connection.js +++ b/AdobeStockAdminUi/view/adminhtml/web/js/connection.js @@ -11,7 +11,7 @@ define([ return Component.extend({ defaults: { - template: 'Magento_AdobeStockAsset/connection', + template: 'Magento_AdobeStockAdminUi/connection', defaultErrorMessage: 'Connection test failed.', apiKeyInputId: 'system_adobe_stock_integration_api_key', url: '', diff --git a/AdobeStockAsset/etc/di.xml b/AdobeStockAsset/etc/di.xml index 76e4c9a4c7ed..d42ae0a83d08 100644 --- a/AdobeStockAsset/etc/di.xml +++ b/AdobeStockAsset/etc/di.xml @@ -22,9 +22,6 @@ - - - diff --git a/AdobeStockClient/Model/Client.php b/AdobeStockClient/Model/Client.php index 0d142046c9a0..14fa90f19e5f 100644 --- a/AdobeStockClient/Model/Client.php +++ b/AdobeStockClient/Model/Client.php @@ -14,24 +14,21 @@ use AdobeStock\Api\Models\StockFile; use AdobeStock\Api\Request\SearchFiles as SearchFilesRequest; use Exception; -use Magento\AdobeStockAsset\Model\OAuth\OAuthException; -use Magento\AdobeStockAsset\Model\OAuth\TokenResponse; +use Magento\AdobeImsApi\Api\Data\ConfigInterface as ImsConfig; use Magento\AdobeStockClientApi\Api\ClientInterface; +use Magento\AdobeStockClientApi\Api\Data\ConfigInterface; use Magento\AdobeStockClientApi\Api\SearchParameterProviderInterface; use Magento\Framework\Api\AttributeValue; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Api\Search\DocumentFactory; use Magento\Framework\Api\Search\DocumentInterface; -use Magento\Framework\Api\SearchCriteriaInterface; -use Magento\Framework\Api\Search\SearchResultInterface; use Magento\Framework\Api\Search\SearchResultFactory; +use Magento\Framework\Api\Search\SearchResultInterface; +use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\AuthenticationException; -use Magento\Framework\Exception\AuthorizationException; use Magento\Framework\Exception\IntegrationException; -use Magento\Framework\HTTP\Client\CurlFactory; use Magento\Framework\Locale\ResolverInterface as LocaleResolver; use Magento\Framework\Phrase; -use Magento\Framework\Serialize\Serializer\Json; use Psr\Log\LoggerInterface; /** @@ -42,7 +39,12 @@ class Client implements ClientInterface /** * @var Config */ - private $config; + private $clientConfig; + + /** + * @var ImsConfig + */ + private $imsConfig; /** * @var SearchResultFactory @@ -74,21 +76,6 @@ class Client implements ClientInterface */ private $connectionFactory; - /** - * @var CurlFactory - */ - private $curlFactory; - - /** - * @var OAuth\TokenResponseFactory - */ - private $tokenResponseFactory; - - /** - * @var Json - */ - private $json; - /** * @var LoggerInterface */ @@ -96,41 +83,35 @@ class Client implements ClientInterface /** * Client constructor. - * @param Config $config + * @param ConfigInterface $clientConfig + * @param ImsConfig $imsConfig * @param DocumentFactory $documentFactory * @param SearchResultFactory $searchResultFactory * @param AttributeValueFactory $attributeValueFactory * @param SearchParameterProviderInterface $searchParametersProvider * @param LocaleResolver $localeResolver * @param ConnectionFactory $connectionFactory - * @param CurlFactory $curlFactory - * @param OAuth\TokenResponseFactory $tokenResponseFactory - * @param Json $json * @param LoggerInterface $logger */ public function __construct( - Config $config, + ConfigInterface $clientConfig, + ImsConfig $imsConfig, DocumentFactory $documentFactory, SearchResultFactory $searchResultFactory, AttributeValueFactory $attributeValueFactory, SearchParameterProviderInterface $searchParametersProvider, LocaleResolver $localeResolver, ConnectionFactory $connectionFactory, - CurlFactory $curlFactory, - OAuth\TokenResponseFactory $tokenResponseFactory, - Json $json, LoggerInterface $logger ) { - $this->config = $config; + $this->clientConfig = $clientConfig; + $this->imsConfig = $imsConfig; $this->documentFactory = $documentFactory; $this->searchResultFactory = $searchResultFactory; $this->attributeValueFactory = $attributeValueFactory; $this->searchParametersProvider = $searchParametersProvider; $this->localeResolver = $localeResolver; $this->connectionFactory = $connectionFactory; - $this->curlFactory = $curlFactory; - $this->tokenResponseFactory = $tokenResponseFactory; - $this->json = $json; $this->logger = $logger; } @@ -229,7 +210,7 @@ private function getResultColumns(): array { $resultsColumns = Constants::getResultColumns(); $resultColumnArray = []; - foreach ($this->config->getSearchResultFields() as $field) { + foreach ($this->clientConfig->getSearchResultFields() as $field) { if (!isset($resultsColumns[$field])) { $message = __('Cannot retrieve the field %1. It\'s not available in Adobe Stock SDK', $field); $this->logger->critical($message); @@ -240,39 +221,6 @@ private function getResultColumns(): array return $resultColumnArray; } - /** - * @inheritdoc - */ - public function getToken(string $code): OAuth\TokenResponse - { - $curl = $this->curlFactory->create(); - - $curl->addHeader('Content-Type', 'application/x-www-form-urlencoded'); - $curl->addHeader('cache-control', 'no-cache'); - - $curl->post( - $this->config->getTokenUrl(), - [ - 'client_id' => $this->config->getApiKey(), - 'client_secret' => $this->config->getPrivateKey(), - 'code' => $code, - 'grant_type' => 'authorization_code' - ] - ); - - $tokenResponse = $this->json->unserialize($curl->getBody()); - $tokenResponse = $this->tokenResponseFactory->create() - ->addData(is_array($tokenResponse) ? $tokenResponse : ['error' => __('The response is empty.')]); - - if (empty($tokenResponse->getAccessToken()) || empty($tokenResponse->getRefreshToken())) { - throw new AuthorizationException( - __('Authentication is failing. Error code: %1', $tokenResponse->getError()) - ); - } - - return $tokenResponse; - } - /** * Create custom attributes for columns returned by search * @@ -325,11 +273,11 @@ private function createAttributes(string $idFieldName, array $itemData): array private function getConnection(string $key = null): AdobeStock { try { - $apiKey = !empty($key) ? $key : $this->config->getApiKey(); + $apiKey = !empty($key) ? $key : $this->imsConfig->getApiKey(); return $this->connectionFactory->create( $apiKey, - $this->config->getProductName(), - $this->config->getTargetEnvironment() + $this->clientConfig->getProductName(), + $this->clientConfig->getTargetEnvironment() ); } catch (Exception $exception) { $message = __( diff --git a/AdobeStockClient/Model/Config.php b/AdobeStockClient/Model/Config.php index 9c033294284d..1c4d39c04a97 100644 --- a/AdobeStockClient/Model/Config.php +++ b/AdobeStockClient/Model/Config.php @@ -18,12 +18,8 @@ */ class Config implements ConfigInterface { - private const XML_PATH_API_KEY = 'adobe_stock/integration/api_key'; - private const XML_PATH_PRIVATE_KEY = 'adobe_stock/integration/private_key'; private const XML_PATH_ENVIRONMENT = 'adobe_stock/integration/environment'; private const XML_PATH_PRODUCT_NAME = 'adobe_stock/integration/product_name'; - private const XML_PATH_TOKEN_URL = 'adobe_stock/integration/token_url'; - private const XML_PATH_AUTH_URL_PATTERN = 'adobe_stock/integration/auth_url_pattern'; /** * @var ScopeConfigInterface @@ -56,26 +52,6 @@ public function __construct( $this->searchResultFields = $searchResultFields; } - /** - * Retrieve integration API key (Client ID) - * - * @return string|null - */ - public function getApiKey():? string - { - return $this->scopeConfig->getValue(self::XML_PATH_API_KEY); - } - - /** - * Retrieve integration API private KEY (Client secret) - * - * @return string - */ - public function getPrivateKey(): string - { - return (string)$this->scopeConfig->getValue(self::XML_PATH_PRIVATE_KEY); - } - /** * Environment configuration * @@ -96,30 +72,6 @@ public function getProductName() : ?string return $this->scopeConfig->getValue(self::XML_PATH_PRODUCT_NAME); } - /** - * Retrieve token URL - * - * @return string - */ - public function getTokenUrl(): string - { - return $this->scopeConfig->getValue(self::XML_PATH_TOKEN_URL); - } - - /** - * Retrieve auth URL - * - * @return string - */ - public function getAuthUrl(): string - { - return str_replace( - ['#{client_id}', '#{redirect_uri}', '#{locale}'], - [$this->getApiKey(), $this->getCallBackUrl(), $this->getLocale()], - $this->scopeConfig->getValue(self::XML_PATH_AUTH_URL_PATTERN) - ); - } - /** * Search result configuration * @@ -130,16 +82,6 @@ public function getSearchResultFields(): array return $this->searchResultFields; } - /** - * Retrieve Callback URL - * - * @return string - */ - public function getCallBackUrl(): string - { - return $this->url->getUrl('adobe_stock/oauth/callback'); - } - /** * Retrieve token URL * diff --git a/AdobeStockClient/Model/SearchParametersProvider/MediaId.php b/AdobeStockClient/Model/SearchParametersProvider/MediaId.php index f6805ee23d94..4605593ac8b2 100644 --- a/AdobeStockClient/Model/SearchParametersProvider/MediaId.php +++ b/AdobeStockClient/Model/SearchParametersProvider/MediaId.php @@ -26,8 +26,7 @@ public function apply(SearchCriteriaInterface $searchCriteria, SearchParameters foreach ($searchCriteria->getFilterGroups() as $filterGroup) { foreach ($filterGroup->getFilters() as $filter) { if ($filter->getField() === 'media_id') { - // Todo parameter expected to be int, string given - $searchParams->setMediaId($filter->getValue()); + $searchParams->setMediaId((int) $filter->getValue()); } } } diff --git a/AdobeStockClient/Test/Unit/Model/ConfigTest.php b/AdobeStockClient/Test/Unit/Model/ConfigTest.php index ac7d62562863..38c3d10542d2 100644 --- a/AdobeStockClient/Test/Unit/Model/ConfigTest.php +++ b/AdobeStockClient/Test/Unit/Model/ConfigTest.php @@ -57,17 +57,6 @@ public function setUp(): void ); } - /** - * Get API key test. - */ - public function testGetApiKey(): void - { - $this->scopeConfigMock->expects($this->once()) - ->method('getValue') - ->with(self::CONFIG_XML_PATH_API_KEY); - $this->config->getApiKey(); - } - /** * Get target environment test. */ diff --git a/AdobeStockClient/Test/Unit/Model/SearchParametersProviderCompositeTest.php b/AdobeStockClient/Test/Unit/Model/SearchParametersProviderCompositeTest.php index aec69dc07b55..8346756b8a2e 100644 --- a/AdobeStockClient/Test/Unit/Model/SearchParametersProviderCompositeTest.php +++ b/AdobeStockClient/Test/Unit/Model/SearchParametersProviderCompositeTest.php @@ -7,12 +7,12 @@ namespace Magento\AdobeStockClient\Test\Unit\Model; -use PHPUnit\Framework\TestCase; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use AdobeStock\Api\Models\SearchParameters; use Magento\AdobeStockClient\Model\SearchParametersProviderComposite; use Magento\AdobeStockClientApi\Api\SearchParameterProviderInterface; use Magento\Framework\Api\SearchCriteriaInterface; -use AdobeStock\Api\Models\SearchParameters; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\TestCase; /** * Test for search parameters provider. diff --git a/AdobeStockClient/etc/config.xml b/AdobeStockClient/etc/config.xml index 574632383f5a..7987d1aa451c 100644 --- a/AdobeStockClient/etc/config.xml +++ b/AdobeStockClient/etc/config.xml @@ -10,12 +10,8 @@ 1 - - PROD magento-adobe-stock-integration - https://ims-na1.adobelogin.com/ims/token - diff --git a/AdobeStockClientApi/Api/ClientInterface.php b/AdobeStockClientApi/Api/ClientInterface.php index 26d33703f014..2f326f3bbd95 100644 --- a/AdobeStockClientApi/Api/ClientInterface.php +++ b/AdobeStockClientApi/Api/ClientInterface.php @@ -8,10 +8,8 @@ namespace Magento\AdobeStockClientApi\Api; -use Magento\AdobeStockClient\Model\OAuth\TokenResponse; -use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Api\Search\SearchResultInterface; -use Magento\Framework\Exception\AuthorizationException; +use Magento\Framework\Api\SearchCriteriaInterface; /** * Adobe Stock API Client @@ -26,15 +24,6 @@ interface ClientInterface */ public function search(SearchCriteriaInterface $searchCriteria): SearchResultInterface; - /** - * Get access tokens from Adobe stock IMS - * - * @param string $code - * @return TokenResponse - * @throws AuthorizationException - */ - public function getToken(string $code): TokenResponse; - /** * Perform a basic request to Adobe Stock API to check network connection, API key, etc. * diff --git a/AdobeStockClientApi/Api/Data/ConfigInterface.php b/AdobeStockClientApi/Api/Data/ConfigInterface.php index ef1f2631d9aa..ef4ef9f50bcd 100644 --- a/AdobeStockClientApi/Api/Data/ConfigInterface.php +++ b/AdobeStockClientApi/Api/Data/ConfigInterface.php @@ -14,19 +14,6 @@ */ interface ConfigInterface { - /** - * Retrieve integration API key (Client ID) - * - * @return string|null - */ - public function getApiKey():? string; - - /** - * Retrieve integration API private KEY (Client secret) - * - * @return string - */ - public function getPrivateKey(): string; /** * Environment configuration * @@ -41,20 +28,6 @@ public function getTargetEnvironment() : ?string; */ public function getProductName() : ?string; - /** - * Retrieve token URL - * - * @return string - */ - public function getTokenUrl(): string; - - /** - * Retrieve auth URL - * - * @return string - */ - public function getAuthUrl(): string; - /** * Search result configuration * @@ -62,13 +35,6 @@ public function getAuthUrl(): string; */ public function getSearchResultFields(): array; - /** - * Retrieve Callback URL - * - * @return string - */ - public function getCallBackUrl(): string; - /** * Retrieve token URL * diff --git a/AdobeStockImageAdminUi/Ui/Component/Listing/Columns/ImagePreview.php b/AdobeStockImageAdminUi/Ui/Component/Listing/Columns/ImagePreview.php index 1304fcdc64cd..7189429cbcba 100644 --- a/AdobeStockImageAdminUi/Ui/Component/Listing/Columns/ImagePreview.php +++ b/AdobeStockImageAdminUi/Ui/Component/Listing/Columns/ImagePreview.php @@ -9,9 +9,9 @@ namespace Magento\AdobeStockImageAdminUi\Ui\Component\Listing\Columns; use Exception; -use Magento\AdobeStockAsset\Controller\Adminhtml\OAuth\Callback; -use Magento\AdobeStockAssetApi\Api\UserProfileRepositoryInterface; -use Magento\AdobeStockClientApi\Api\Data\ConfigInterface; +use Magento\AdobeIms\Controller\Adminhtml\OAuth\Callback; +use Magento\AdobeImsApi\Api\UserProfileRepositoryInterface; +use Magento\AdobeImsApi\Api\Data\ConfigInterface; use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\UrlInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; diff --git a/AdobeStockImageAdminUi/composer.json b/AdobeStockImageAdminUi/composer.json index 1be7e2704f7a..bc1aaaf94076 100644 --- a/AdobeStockImageAdminUi/composer.json +++ b/AdobeStockImageAdminUi/composer.json @@ -7,7 +7,9 @@ "magento/module-ui": "*", "magento/module-backend": "*", "magento/module-adobe-stock-image-api": "*", - "magento/module-adobe-stock-asset-api": "*" + "magento/module-adobe-stock-asset-api": "*", + "magento/module-adobe-ims": "*", + "magento/module-adobe-ims-api": "*" }, "suggest": { "magento/module-cms": "*" diff --git a/AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/image-preview.js b/AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/image-preview.js index 5ea0485fd115..6018de752f4d 100644 --- a/AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/image-preview.js +++ b/AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/image-preview.js @@ -7,7 +7,7 @@ define([ 'jquery', 'knockout', 'Magento_Ui/js/grid/columns/column', - 'Magento_AdobeStockImageAdminUi/js/action/authorization', + 'Magento_AdobeIms/js/action/authorization', 'Magento_AdobeStockImageAdminUi/js/model/messages', 'mage/translate' ], function (_, $, ko, Column, authorizationAction, messages) { @@ -194,10 +194,9 @@ define([ * Set selected row id * * @param {Number} rowId - * @param {Number} [height] * @private */ - _selectRow: function (rowId, height){ + _selectRow: function (rowId){ this.thumbnailComponent().previewRowId(rowId); }, @@ -266,7 +265,7 @@ define([ visibility.fill(false); this.visibility(visibility); this.height(0); - this._selectRow(null, 0); + this._selectRow(null); }, /** diff --git a/_metapackage/composer.json b/_metapackage/composer.json index fcbfab124b30..5a894667c537 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -10,6 +10,7 @@ "magento/module-adobe-stock-image-api": "*", "magento/module-adobe-stock-client": "*", "magento/module-adobe-stock-client-api": "*", - "magento/module-adobe-stock-admin-ui": "*" + "magento/module-adobe-stock-admin-ui": "*", + "magento/module-adobe-ims": "*" } } diff --git a/modman b/modman index 1ca1030c7f42..fe36019d3da8 100644 --- a/modman +++ b/modman @@ -1,3 +1,5 @@ +@import AdobeIms +@import AdobeImsApi @import AdobeStockAdminUi @import AdobeStockAsset @import AdobeStockAssetApi