@graphcommerce/algolia-products 9.0.0-canary.84

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/Config.graphqls +54 -0
  3. package/README.md +79 -0
  4. package/algolia-spec.yaml +4418 -0
  5. package/graphql/CustomerGroupId.graphql +3 -0
  6. package/graphql/GetAlgoliaSettings.graphql +122 -0
  7. package/graphql/ProductListItems_Algolia.graphql +3 -0
  8. package/hooks/useAlgoliaIndexName.ts +5 -0
  9. package/hooks/useAlgoliaQueryContext.ts +11 -0
  10. package/index.ts +8 -0
  11. package/link/customerGroupIdLink.ts +20 -0
  12. package/mesh/algoliaFacetsToAggregations.ts +209 -0
  13. package/mesh/algoliaHitToMagentoProduct.ts +191 -0
  14. package/mesh/getAlgoliaSettings.ts +21 -0
  15. package/mesh/getAttributeList.ts +31 -0
  16. package/mesh/getGroupId.ts +7 -0
  17. package/mesh/getIndexName.ts +11 -0
  18. package/mesh/getSearchResults.ts +35 -0
  19. package/mesh/getSearchResultsInput.ts +30 -0
  20. package/mesh/getSearchSuggestions.ts +27 -0
  21. package/mesh/getSearchSuggestionsInput.ts +21 -0
  22. package/mesh/getStoreConfig.ts +33 -0
  23. package/mesh/productFilterInputToAlgoliafacetFiltersInput.ts +81 -0
  24. package/mesh/resolvers.ts +126 -0
  25. package/mesh/sortOptions.ts +76 -0
  26. package/mesh/utils.ts +3 -0
  27. package/next-env.d.ts +4 -0
  28. package/package.json +32 -0
  29. package/plugins/GraphQLProviderAlgoliaCustomerGroupId.tsx +14 -0
  30. package/plugins/ProductListItemsBaseAlgolia.tsx +21 -0
  31. package/plugins/magentoProductApplyAlgoliaEngine.ts +25 -0
  32. package/plugins/magentoSearchApplyAlgoliaEngine.ts +26 -0
  33. package/plugins/meshConfigAlgolia.ts +66 -0
  34. package/schema/AlgoliaSchema.graphqls +60 -0
  35. package/schema/CustomerAlgoliaGroupId.graphqls +9 -0
  36. package/scripts/base-schema-filter.mts +45 -0
  37. package/scripts/generate-spec.mts +69 -0
  38. package/tsconfig.json +5 -0
  39. package/utils/applyCategoryEngineVariable.ts +11 -0
  40. package/utils/applyEngineVariable.ts +11 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,69 @@
1
+ # @graphcommerce/algolia-products
2
+
3
+ ## 9.0.0-canary.84
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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))
8
+
9
+ ## 9.0.0-canary.83
10
+
11
+ ## 9.0.0-canary.82
12
+
13
+ ## 9.0.0-canary.81
14
+
15
+ ## 9.0.0-canary.80
16
+
17
+ ## 9.0.0-canary.79
18
+
19
+ ## 9.0.0-canary.78
20
+
21
+ ## 9.0.0-canary.77
22
+
23
+ ## 9.0.0-canary.76
24
+
25
+ ## 9.0.0-canary.75
26
+
27
+ ## 9.0.0-canary.74
28
+
29
+ ## 9.0.0-canary.73
30
+
31
+ ## 9.0.0-canary.72
32
+
33
+ ## 9.0.0-canary.71
34
+
35
+ ## 9.0.0-canary.70
36
+
37
+ ## 9.0.0-canary.69
38
+
39
+ ## 9.0.0-canary.68
40
+
41
+ ## 9.0.0-canary.67
42
+
43
+ ### Patch Changes
44
+
45
+ - [#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))
46
+
47
+ ## 9.0.0-canary.66
48
+
49
+ ## 9.0.0-canary.65
50
+
51
+ ## 9.0.0-canary.64
52
+
53
+ ### Patch Changes
54
+
55
+ - [#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))
56
+
57
+ ## 9.0.0-canary.63
58
+
59
+ ## 9.0.0-canary.62
60
+
61
+ ## 9.0.0-canary.61
62
+
63
+ ## 9.0.0-canary.60
64
+
65
+ ## 9.0.0-canary.59
66
+
67
+ ### Minor Changes
68
+
69
+ - [#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))
@@ -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