Skip to content

Commit 8214531

Browse files
authored
Merge pull request #1584 from algolia/release/3.14.0
Release/3.14.0
2 parents 72622b6 + 4b3193e commit 8214531

File tree

131 files changed

+7639
-4169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+7639
-4169
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Console;
4+
5+
interface ReplicaDeleteCommandInterface
6+
{
7+
public function deleteReplicas(array $storeIds = [], bool $unused = false): void;
8+
public function deleteReplicasForStore(int $storeId, bool $unused = false): void;
9+
public function deleteReplicasForAllStores(bool $unused = false): void;
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Console;
4+
5+
interface ReplicaSyncCommandInterface
6+
{
7+
public function syncReplicas(array $storeIds = []): void;
8+
public function syncReplicasForStore(int $storeId): void;
9+
public function syncReplicasForAllStores(): void;
10+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Insights;
4+
5+
use Algolia\AlgoliaSearch\Api\InsightsClient;
6+
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;
7+
use Magento\Framework\Exception\LocalizedException;
8+
use Magento\Quote\Model\Quote\Item;
9+
use Magento\Sales\Model\Order;
10+
use Magento\Store\Model\StoreManagerInterface;
11+
12+
interface EventProcessorInterface
13+
{
14+
/** @var string */
15+
public const EVENT_KEY_SUBTYPE = 'eventSubtype';
16+
/** @var string */
17+
public const EVENT_KEY_OBJECT_IDS = 'objectIDs';
18+
/** @var string */
19+
public const EVENT_KEY_OBJECT_DATA = 'objectData';
20+
/** @var string */
21+
public const EVENT_KEY_CURRENCY = 'currency';
22+
/** @var string */
23+
public const EVENT_KEY_VALUE = 'value';
24+
/** @var string */
25+
public const EVENT_KEY_QUERY_ID = 'queryID';
26+
27+
/** @var string */
28+
public const EVENT_SUBTYPE_CART = 'addToCart';
29+
/** @var string */
30+
public const EVENT_SUBTYPE_PURCHASE = 'purchase';
31+
32+
// https://www.algolia.com/doc/rest-api/insights/#method-param-objectids
33+
/** @var int */
34+
public const MAX_OBJECT_IDS_PER_EVENT = 20;
35+
36+
// https://www.algolia.com/doc/rest-api/insights/#events-endpoints
37+
/** @var int */
38+
public const MAX_EVENTS_PER_REQUEST = 1000;
39+
40+
public function setInsightsClient(InsightsClient $client): EventProcessorInterface;
41+
42+
public function setAuthenticatedUserToken(string $token): EventProcessorInterface;
43+
44+
public function setAnonymousUserToken(string $token): EventProcessorInterface;
45+
46+
public function setStoreManager(StoreManagerInterface $storeManager): EventProcessorInterface;
47+
48+
/**
49+
* @param string $eventName
50+
* @param string $indexName
51+
* @param array $objectIDs
52+
* @param string $queryID
53+
* @param array $requestOptions
54+
* @return array<string, mixed> API response
55+
* @throws AlgoliaException
56+
*/
57+
public function convertedObjectIDsAfterSearch(
58+
string $eventName,
59+
string $indexName,
60+
array $objectIDs,
61+
string $queryID,
62+
array $requestOptions = []
63+
): array;
64+
65+
/**
66+
* @param string $eventName
67+
* @param string $indexName
68+
* @param array $objectIDs
69+
* @param array $requestOptions
70+
* @return array<string, mixed> API response
71+
* @throws AlgoliaException
72+
*/
73+
public function convertedObjectIDs(
74+
string $eventName,
75+
string $indexName,
76+
array $objectIDs,
77+
array $requestOptions = []
78+
): array;
79+
80+
/**
81+
* Track conversion for add to cart operation
82+
* @param string $eventName
83+
* @param string $indexName
84+
* @param Item $item
85+
* @param string|null $queryID specify if conversion is result of a search
86+
* @return array<string, mixed> API response
87+
* @throws AlgoliaException
88+
* @throws LocalizedException
89+
*/
90+
public function convertAddToCart(
91+
string $eventName,
92+
string $indexName,
93+
Item $item,
94+
string $queryID = null
95+
): array;
96+
97+
/**
98+
* Track purchase conversion for all items on an order in as few batches as possible
99+
* @param string $eventName
100+
* @param string $indexName
101+
* @param Order $order
102+
* @return array<array<string, mixed>> An array of API responses for all batches processed
103+
* @throws AlgoliaException
104+
* @throws LocalizedException
105+
*/
106+
public function convertPurchase(
107+
string $eventName,
108+
string $indexName,
109+
Order $order
110+
): array;
111+
112+
/**
113+
* Track purchase conversion event for an arbitrary group of items
114+
* @param string $eventName
115+
* @param string $indexName
116+
* @param Order\Item[] $items
117+
* @param string|null $queryID
118+
* @return array<string, mixed> API response
119+
* @throws AlgoliaException
120+
* @throws LocalizedException
121+
*/
122+
public function convertPurchaseForItems(
123+
string $eventName,
124+
string $indexName,
125+
array $items,
126+
string $queryID = null
127+
): array;
128+
129+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Api\Product;
4+
5+
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;
6+
use Algolia\AlgoliaSearch\Exceptions\ExceededRetriesException;
7+
use Magento\Framework\Exception\LocalizedException;
8+
use Magento\Framework\Exception\NoSuchEntityException;
9+
10+
interface ReplicaManagerInterface
11+
{
12+
public const SORT_ATTRIBUTE_PRICE = 'price';
13+
14+
public const SORT_KEY_ATTRIBUTE_NAME = 'attribute';
15+
public const SORT_KEY_VIRTUAL_REPLICA = 'virtualReplica';
16+
public const MAX_VIRTUAL_REPLICA_LIMIT = 20;
17+
18+
/**
19+
* Configure replicas in Algolia based on the sorting configuration in Magento
20+
*
21+
* @param int $storeId
22+
* @param array<string, mixed> $primaryIndexSettings
23+
* @return void
24+
*
25+
* @throws AlgoliaException
26+
* @throws ExceededRetriesException
27+
* @throws LocalizedException
28+
*/
29+
public function syncReplicasToAlgolia(int $storeId, array $primaryIndexSettings): void;
30+
31+
/**
32+
* Delete the replica indices on a store index
33+
* @param int $storeId
34+
* @param bool $unused Defaults to false - if true identifies any straggler indices and deletes those, otherwise deletes the replicas it knows aobut
35+
* @return void
36+
*
37+
* @throws LocalizedException
38+
* @throws AlgoliaException
39+
*/
40+
public function deleteReplicasFromAlgolia(int $storeId, bool $unused = false): void;
41+
42+
/**
43+
* For standard Magento front end (e.g. Luma) replicas will likely only be needed if InstantSearch is enabled
44+
* Headless implementations may wish to override this behavior via plugin
45+
* @param int $storeId
46+
* @return bool
47+
*/
48+
public function isReplicaSyncEnabled(int $storeId): bool;
49+
50+
/**
51+
* Return the number of virtual replicas permitted per index
52+
* @link https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#differences
53+
*
54+
* @return int
55+
*/
56+
public function getMaxVirtualReplicasPerIndex() : int;
57+
58+
/**
59+
* For a given store return replicas that do not appear to be managed by Magento
60+
* @param int $storeId
61+
* @return string[]
62+
* @throws NoSuchEntityException
63+
* @throws LocalizedException
64+
* @throws AlgoliaException
65+
*/
66+
public function getUnusedReplicaIndices(int $storeId): array;
67+
}

0 commit comments

Comments
 (0)