-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1584 from algolia/release/3.14.0
Release/3.14.0
- Loading branch information
Showing
131 changed files
with
7,639 additions
and
4,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch\Api\Console; | ||
|
||
interface ReplicaDeleteCommandInterface | ||
{ | ||
public function deleteReplicas(array $storeIds = [], bool $unused = false): void; | ||
public function deleteReplicasForStore(int $storeId, bool $unused = false): void; | ||
public function deleteReplicasForAllStores(bool $unused = false): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch\Api\Console; | ||
|
||
interface ReplicaSyncCommandInterface | ||
{ | ||
public function syncReplicas(array $storeIds = []): void; | ||
public function syncReplicasForStore(int $storeId): void; | ||
public function syncReplicasForAllStores(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch\Api\Insights; | ||
|
||
use Algolia\AlgoliaSearch\Api\InsightsClient; | ||
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Quote\Model\Quote\Item; | ||
use Magento\Sales\Model\Order; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
interface EventProcessorInterface | ||
{ | ||
/** @var string */ | ||
public const EVENT_KEY_SUBTYPE = 'eventSubtype'; | ||
/** @var string */ | ||
public const EVENT_KEY_OBJECT_IDS = 'objectIDs'; | ||
/** @var string */ | ||
public const EVENT_KEY_OBJECT_DATA = 'objectData'; | ||
/** @var string */ | ||
public const EVENT_KEY_CURRENCY = 'currency'; | ||
/** @var string */ | ||
public const EVENT_KEY_VALUE = 'value'; | ||
/** @var string */ | ||
public const EVENT_KEY_QUERY_ID = 'queryID'; | ||
|
||
/** @var string */ | ||
public const EVENT_SUBTYPE_CART = 'addToCart'; | ||
/** @var string */ | ||
public const EVENT_SUBTYPE_PURCHASE = 'purchase'; | ||
|
||
// https://www.algolia.com/doc/rest-api/insights/#method-param-objectids | ||
/** @var int */ | ||
public const MAX_OBJECT_IDS_PER_EVENT = 20; | ||
|
||
// https://www.algolia.com/doc/rest-api/insights/#events-endpoints | ||
/** @var int */ | ||
public const MAX_EVENTS_PER_REQUEST = 1000; | ||
|
||
public function setInsightsClient(InsightsClient $client): EventProcessorInterface; | ||
|
||
public function setAuthenticatedUserToken(string $token): EventProcessorInterface; | ||
|
||
public function setAnonymousUserToken(string $token): EventProcessorInterface; | ||
|
||
public function setStoreManager(StoreManagerInterface $storeManager): EventProcessorInterface; | ||
|
||
/** | ||
* @param string $eventName | ||
* @param string $indexName | ||
* @param array $objectIDs | ||
* @param string $queryID | ||
* @param array $requestOptions | ||
* @return array<string, mixed> API response | ||
* @throws AlgoliaException | ||
*/ | ||
public function convertedObjectIDsAfterSearch( | ||
string $eventName, | ||
string $indexName, | ||
array $objectIDs, | ||
string $queryID, | ||
array $requestOptions = [] | ||
): array; | ||
|
||
/** | ||
* @param string $eventName | ||
* @param string $indexName | ||
* @param array $objectIDs | ||
* @param array $requestOptions | ||
* @return array<string, mixed> API response | ||
* @throws AlgoliaException | ||
*/ | ||
public function convertedObjectIDs( | ||
string $eventName, | ||
string $indexName, | ||
array $objectIDs, | ||
array $requestOptions = [] | ||
): array; | ||
|
||
/** | ||
* Track conversion for add to cart operation | ||
* @param string $eventName | ||
* @param string $indexName | ||
* @param Item $item | ||
* @param string|null $queryID specify if conversion is result of a search | ||
* @return array<string, mixed> API response | ||
* @throws AlgoliaException | ||
* @throws LocalizedException | ||
*/ | ||
public function convertAddToCart( | ||
string $eventName, | ||
string $indexName, | ||
Item $item, | ||
string $queryID = null | ||
): array; | ||
|
||
/** | ||
* Track purchase conversion for all items on an order in as few batches as possible | ||
* @param string $eventName | ||
* @param string $indexName | ||
* @param Order $order | ||
* @return array<array<string, mixed>> An array of API responses for all batches processed | ||
* @throws AlgoliaException | ||
* @throws LocalizedException | ||
*/ | ||
public function convertPurchase( | ||
string $eventName, | ||
string $indexName, | ||
Order $order | ||
): array; | ||
|
||
/** | ||
* Track purchase conversion event for an arbitrary group of items | ||
* @param string $eventName | ||
* @param string $indexName | ||
* @param Order\Item[] $items | ||
* @param string|null $queryID | ||
* @return array<string, mixed> API response | ||
* @throws AlgoliaException | ||
* @throws LocalizedException | ||
*/ | ||
public function convertPurchaseForItems( | ||
string $eventName, | ||
string $indexName, | ||
array $items, | ||
string $queryID = null | ||
): array; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch\Api\Product; | ||
|
||
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException; | ||
use Algolia\AlgoliaSearch\Exceptions\ExceededRetriesException; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
|
||
interface ReplicaManagerInterface | ||
{ | ||
public const SORT_ATTRIBUTE_PRICE = 'price'; | ||
|
||
public const SORT_KEY_ATTRIBUTE_NAME = 'attribute'; | ||
public const SORT_KEY_VIRTUAL_REPLICA = 'virtualReplica'; | ||
public const MAX_VIRTUAL_REPLICA_LIMIT = 20; | ||
|
||
/** | ||
* Configure replicas in Algolia based on the sorting configuration in Magento | ||
* | ||
* @param int $storeId | ||
* @param array<string, mixed> $primaryIndexSettings | ||
* @return void | ||
* | ||
* @throws AlgoliaException | ||
* @throws ExceededRetriesException | ||
* @throws LocalizedException | ||
*/ | ||
public function syncReplicasToAlgolia(int $storeId, array $primaryIndexSettings): void; | ||
|
||
/** | ||
* Delete the replica indices on a store index | ||
* @param int $storeId | ||
* @param bool $unused Defaults to false - if true identifies any straggler indices and deletes those, otherwise deletes the replicas it knows aobut | ||
* @return void | ||
* | ||
* @throws LocalizedException | ||
* @throws AlgoliaException | ||
*/ | ||
public function deleteReplicasFromAlgolia(int $storeId, bool $unused = false): void; | ||
|
||
/** | ||
* For standard Magento front end (e.g. Luma) replicas will likely only be needed if InstantSearch is enabled | ||
* Headless implementations may wish to override this behavior via plugin | ||
* @param int $storeId | ||
* @return bool | ||
*/ | ||
public function isReplicaSyncEnabled(int $storeId): bool; | ||
|
||
/** | ||
* Return the number of virtual replicas permitted per index | ||
* @link https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#differences | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxVirtualReplicasPerIndex() : int; | ||
|
||
/** | ||
* For a given store return replicas that do not appear to be managed by Magento | ||
* @param int $storeId | ||
* @return string[] | ||
* @throws NoSuchEntityException | ||
* @throws LocalizedException | ||
* @throws AlgoliaException | ||
*/ | ||
public function getUnusedReplicaIndices(int $storeId): array; | ||
} |
Oops, something went wrong.