@graphcommerce/algolia-products 9.0.0-canary.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/Config.graphqls +54 -0
- package/README.md +79 -0
- package/algolia-spec.yaml +4418 -0
- package/graphql/CustomerGroupId.graphql +3 -0
- package/graphql/GetAlgoliaSettings.graphql +122 -0
- package/graphql/ProductListItems_Algolia.graphql +3 -0
- package/hooks/useAlgoliaIndexName.ts +5 -0
- package/hooks/useAlgoliaQueryContext.ts +11 -0
- package/index.ts +8 -0
- package/link/customerGroupIdLink.ts +20 -0
- package/mesh/algoliaFacetsToAggregations.ts +209 -0
- package/mesh/algoliaHitToMagentoProduct.ts +201 -0
- package/mesh/getAlgoliaSettings.ts +21 -0
- package/mesh/getAttributeList.ts +31 -0
- package/mesh/getGroupId.ts +7 -0
- package/mesh/getIndexName.ts +11 -0
- package/mesh/getSearchResults.ts +35 -0
- package/mesh/getSearchResultsInput.ts +30 -0
- package/mesh/getSearchSuggestions.ts +27 -0
- package/mesh/getSearchSuggestionsInput.ts +21 -0
- package/mesh/getStoreConfig.ts +33 -0
- package/mesh/productFilterInputToAlgoliafacetFiltersInput.ts +81 -0
- package/mesh/resolvers.ts +126 -0
- package/mesh/sortOptions.ts +76 -0
- package/mesh/utils.ts +3 -0
- package/next-env.d.ts +4 -0
- package/package.json +32 -0
- package/plugins/GraphQLProviderAlgoliaCustomerGroupId.tsx +14 -0
- package/plugins/ProductListItemsBaseAlgolia.tsx +21 -0
- package/plugins/magentoProductApplyAlgoliaEngine.ts +25 -0
- package/plugins/magentoSearchApplyAlgoliaEngine.ts +26 -0
- package/plugins/meshConfigAlgolia.ts +66 -0
- package/schema/AlgoliaSchema.graphqls +60 -0
- package/schema/CustomerAlgoliaGroupId.graphqls +9 -0
- package/scripts/base-schema-filter.mts +45 -0
- package/scripts/generate-spec.mts +69 -0
- package/tsconfig.json +5 -0
- package/utils/applyCategoryEngineVariable.ts +11 -0
- package/utils/applyEngineVariable.ts +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @graphcommerce/algolia-products
|
|
2
|
+
|
|
3
|
+
## 9.0.0-canary.100
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2417](https://github.com/graphcommerce-org/graphcommerce/pull/2417) [`743e7e2`](https://github.com/graphcommerce-org/graphcommerce/commit/743e7e275c8f0bfe32a5240c08eed92120085cc0) - Prevent errors by returning string instead of array ([@Renzovh](https://github.com/Renzovh))
|
|
8
|
+
|
|
9
|
+
## 9.0.0-canary.99
|
|
10
|
+
|
|
11
|
+
## 9.0.0-canary.98
|
|
12
|
+
|
|
13
|
+
## 9.0.0-canary.97
|
|
14
|
+
|
|
15
|
+
## 9.0.0-canary.96
|
|
16
|
+
|
|
17
|
+
## 9.0.0-canary.95
|
|
18
|
+
|
|
19
|
+
## 9.0.0-canary.94
|
|
20
|
+
|
|
21
|
+
## 9.0.0-canary.93
|
|
22
|
+
|
|
23
|
+
## 9.0.0-canary.92
|
|
24
|
+
|
|
25
|
+
## 9.0.0-canary.91
|
|
26
|
+
|
|
27
|
+
## 9.0.0-canary.90
|
|
28
|
+
|
|
29
|
+
## 9.0.0-canary.89
|
|
30
|
+
|
|
31
|
+
## 9.0.0-canary.88
|
|
32
|
+
|
|
33
|
+
## 9.0.0-canary.87
|
|
34
|
+
|
|
35
|
+
## 9.0.0-canary.86
|
|
36
|
+
|
|
37
|
+
## 9.0.0-canary.85
|
|
38
|
+
|
|
39
|
+
## 9.0.0-canary.84
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
43
|
+
- [#2377](https://github.com/graphcommerce-org/graphcommerce/pull/2377) [`56fcc45`](https://github.com/graphcommerce-org/graphcommerce/commit/56fcc45b60e43574c64fcdd7b02f8062d677e250) - Integrated algolia product queries into graphql-mesh. Provides fast and accurate searches, that can be personalised via magento-algolia and its algolia dashboard ([@Renzovh](https://github.com/Renzovh))
|
|
44
|
+
|
|
45
|
+
## 9.0.0-canary.83
|
|
46
|
+
|
|
47
|
+
## 9.0.0-canary.82
|
|
48
|
+
|
|
49
|
+
## 9.0.0-canary.81
|
|
50
|
+
|
|
51
|
+
## 9.0.0-canary.80
|
|
52
|
+
|
|
53
|
+
## 9.0.0-canary.79
|
|
54
|
+
|
|
55
|
+
## 9.0.0-canary.78
|
|
56
|
+
|
|
57
|
+
## 9.0.0-canary.77
|
|
58
|
+
|
|
59
|
+
## 9.0.0-canary.76
|
|
60
|
+
|
|
61
|
+
## 9.0.0-canary.75
|
|
62
|
+
|
|
63
|
+
## 9.0.0-canary.74
|
|
64
|
+
|
|
65
|
+
## 9.0.0-canary.73
|
|
66
|
+
|
|
67
|
+
## 9.0.0-canary.72
|
|
68
|
+
|
|
69
|
+
## 9.0.0-canary.71
|
|
70
|
+
|
|
71
|
+
## 9.0.0-canary.70
|
|
72
|
+
|
|
73
|
+
## 9.0.0-canary.69
|
|
74
|
+
|
|
75
|
+
## 9.0.0-canary.68
|
|
76
|
+
|
|
77
|
+
## 9.0.0-canary.67
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- [#2336](https://github.com/graphcommerce-org/graphcommerce/pull/2336) [`95ce63c`](https://github.com/graphcommerce-org/graphcommerce/commit/95ce63cd32463835239ba959734cdaf1aa7f3f7b) - Added algolia search suggestions ([@Renzovh](https://github.com/Renzovh))
|
|
82
|
+
|
|
83
|
+
## 9.0.0-canary.66
|
|
84
|
+
|
|
85
|
+
## 9.0.0-canary.65
|
|
86
|
+
|
|
87
|
+
## 9.0.0-canary.64
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- [#2334](https://github.com/graphcommerce-org/graphcommerce/pull/2334) [`3140735`](https://github.com/graphcommerce-org/graphcommerce/commit/3140735a8a49f8bebcbfde4e581515884446e05d) - Added support for customer group pricing ([@Renzovh](https://github.com/Renzovh))
|
|
92
|
+
|
|
93
|
+
## 9.0.0-canary.63
|
|
94
|
+
|
|
95
|
+
## 9.0.0-canary.62
|
|
96
|
+
|
|
97
|
+
## 9.0.0-canary.61
|
|
98
|
+
|
|
99
|
+
## 9.0.0-canary.60
|
|
100
|
+
|
|
101
|
+
## 9.0.0-canary.59
|
|
102
|
+
|
|
103
|
+
### Minor Changes
|
|
104
|
+
|
|
105
|
+
- [#2309](https://github.com/graphcommerce-org/graphcommerce/pull/2309) [`9c1110e`](https://github.com/graphcommerce-org/graphcommerce/commit/9c1110ed018139dec7e7183f783208c158ee7ead) - Algolia Magento 2 implemented as a GraphQL Mesh resolver: Allows full integration without modying any frontend components. ([@Renzovh](https://github.com/Renzovh))
|
package/Config.graphqls
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Algolia configuration for GraphCommerce.
|
|
3
|
+
"""
|
|
4
|
+
input GraphCommerceAlgoliaConfig {
|
|
5
|
+
"""
|
|
6
|
+
Configure your Algolia application ID.
|
|
7
|
+
|
|
8
|
+
Stores > Configuration > Algolia Search > Credentials and Basic Setup > Application ID
|
|
9
|
+
"""
|
|
10
|
+
applicationId: String!
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
Configure your Algolia Search Only API Key.
|
|
14
|
+
|
|
15
|
+
Stores > Configuration > Algolia Search > Credentials and Basic Setup > Search-only (public) API key
|
|
16
|
+
"""
|
|
17
|
+
searchOnlyApiKey: String!
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
Stores > Configuration > Algolia Search > Credentials and Basic Setup > Index name prefix
|
|
21
|
+
"""
|
|
22
|
+
indexNamePrefix: String!
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
By default the catalog will not use algolia. Set this to true to enable Algolia for the catalog.
|
|
26
|
+
"""
|
|
27
|
+
catalogEnabled: Boolean
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
Enable Algolia customer group pricing.
|
|
31
|
+
|
|
32
|
+
Please be aware that personalization needs to be enabled to make this work.
|
|
33
|
+
"""
|
|
34
|
+
customerGroupPricingEnabled: Boolean
|
|
35
|
+
|
|
36
|
+
"""
|
|
37
|
+
To enable Algolia suggestions, please provide the Suffix that is used for your suggestions index.
|
|
38
|
+
|
|
39
|
+
The pattern is `${indexNamePrefix}_{storeCode}_{suggestionsSuffix}`.
|
|
40
|
+
Something like `_suggestions` or `_query_suggestions`
|
|
41
|
+
|
|
42
|
+
For the index `magento2_demo_en_US_suggestions` this would be `_suggestions`
|
|
43
|
+
"""
|
|
44
|
+
suggestionsSuffix: String
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
extend input GraphCommerceConfig {
|
|
48
|
+
"""
|
|
49
|
+
Configure your Algolia application ID.
|
|
50
|
+
|
|
51
|
+
Stores > Configuration > Algolia Search > Credentials and Basic Setup > Application ID
|
|
52
|
+
"""
|
|
53
|
+
algolia: GraphCommerceAlgoliaConfig!
|
|
54
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Algolia Magento 2
|
|
2
|
+
|
|
3
|
+
An implementation of Algolia Products through the GraphQL Mesh.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Make sure the Magento 2 module is correctly installed and working.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
1. Find current version of your `@graphcommerce/next-ui` in your package.json.
|
|
12
|
+
2. `yarn add @graphcommerce/algolia-products@9.0.0` (replace 9.0.0 with the
|
|
13
|
+
version of the step above)
|
|
14
|
+
3. Configure the following ([configuration values](./Config.graphqls)) in your
|
|
15
|
+
graphcommerce.config.js:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const config = {
|
|
19
|
+
algolia: {
|
|
20
|
+
applicationId: 'your-algolia-application-id', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Application ID
|
|
21
|
+
indexNamePrefix: 'default_', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Index name prefix
|
|
22
|
+
searchOnlyApiKey: 'blabla', // Stores > Configuration > Algolia Search > Credentials and Basic Setup > Search-only (public) API key
|
|
23
|
+
catalogEnabled: false, // start with search and if everything works as expected, you can move on to the catalog.
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Configuration
|
|
29
|
+
|
|
30
|
+
1. Setup the fields that you want to index in algolia
|
|
31
|
+
`Stores > configuration > Algolia Search > Products > Products`
|
|
32
|
+
2. Configure your aggregations/filters, make sure that the aggregation fields
|
|
33
|
+
are also indexed in step 2
|
|
34
|
+
`Stores > Configuration > Algolia Search > Instant Search Results Page > Facets`
|
|
35
|
+
3. Make sure the aggregations fields are made filterable(Use in layerd
|
|
36
|
+
Navigation), so the attributeList query can retrieve the labels.
|
|
37
|
+
`Stores > Products > Attributes`
|
|
38
|
+
4. To configure sorting options, enable Virtual Replica's.
|
|
39
|
+
`Stores > Configuration > Algolia Search > Instant Search Results Page > Use Virtual Replica`
|
|
40
|
+
|
|
41
|
+
### Customer Group Pricing
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const config = {
|
|
45
|
+
algoliaCustomerGroupPricingEnabled: true,
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
To enable customer group pricing, make sure customers groups prices are mapped
|
|
50
|
+
to algolia.
|
|
51
|
+
`Stores > Configuration > Algolia Search > Advanced > Enable Customer Groups`.
|
|
52
|
+
|
|
53
|
+
⚠️ Warning: Catalog price rules for a specific customer group do not seem to be
|
|
54
|
+
indexed.It seems only: `[Product] > Advanced Pricing > Customer Group Price`
|
|
55
|
+
gets indexed.
|
|
56
|
+
|
|
57
|
+
Note: The GraphQL API does not expose the customer group_id by default. We're
|
|
58
|
+
doing an additional REST API call to get the value. This means a somewhat slower
|
|
59
|
+
(few hundred ms) when the Customer is loaded.
|
|
60
|
+
|
|
61
|
+
### Customization
|
|
62
|
+
|
|
63
|
+
By default algoliaFacetsToAggregations and algoliaHitToMagentoProduct can be
|
|
64
|
+
plugged in.
|
|
65
|
+
|
|
66
|
+
## Algolia for Catalog
|
|
67
|
+
|
|
68
|
+
Sorting is defined by Algolia and can not be configured per category as each
|
|
69
|
+
sorting option is a separate (virtual) index.
|
|
70
|
+
|
|
71
|
+
## Suggestions
|
|
72
|
+
|
|
73
|
+
To get query suggestions/autocomplete enter your Algolia dashboard > Search >
|
|
74
|
+
configure > Query Suggestions > new Query Suggestions Index. This will create a
|
|
75
|
+
new index which will be used for suggestions
|
|
76
|
+
|
|
77
|
+
Don't mind to use the suggestions setting in magento admin. It will create a
|
|
78
|
+
suggestions index but it will not record suggestions. This requires
|
|
79
|
+
instantSearch
|