@reactionary/provider-algolia 0.3.7 → 0.3.9
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/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/provider-algolia",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@reactionary/core": "0.3.
|
|
7
|
+
"@reactionary/core": "0.3.9",
|
|
8
8
|
"algoliasearch": "^5.48.0",
|
|
9
9
|
"zod": "4.1.9"
|
|
10
10
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProductRecommendationIdentifierSchema } from "@reactionary/core";
|
|
2
|
-
import z from "zod";
|
|
2
|
+
import { z } from "zod";
|
|
3
3
|
const AlgoliaProductSearchIdentifierSchema = ProductRecommendationIdentifierSchema.extend({
|
|
4
4
|
abTestID: z.number().optional(),
|
|
5
5
|
abTestVariantID: z.number().optional()
|
|
@@ -34,60 +34,47 @@ export declare class AlgoliaProductRecommendationsProvider extends ProductRecomm
|
|
|
34
34
|
* Get trending in category recommendations using Algolia Recommend
|
|
35
35
|
*/
|
|
36
36
|
protected getTrendingInCategoryRecommendations(query: ProductRecommendationAlgorithmTrendingInCategoryQuery): Promise<ProductRecommendation[]>;
|
|
37
|
-
protected parseRecommendation(res: RecommendationsResults, query: ProductRecommendationsQuery): ({
|
|
38
|
-
[x: string]: unknown;
|
|
37
|
+
protected parseRecommendation(res: RecommendationsResults, query: ProductRecommendationsQuery): (({
|
|
39
38
|
recommendationIdentifier: {
|
|
40
|
-
[x: string]: unknown;
|
|
41
39
|
key: string;
|
|
42
40
|
algorithm: string;
|
|
43
41
|
};
|
|
44
42
|
recommendationReturnType: "idOnly";
|
|
45
43
|
product: {
|
|
46
|
-
[x: string]: unknown;
|
|
47
44
|
key: string;
|
|
48
45
|
};
|
|
49
|
-
}
|
|
50
|
-
|
|
46
|
+
} & {
|
|
47
|
+
_?: never;
|
|
48
|
+
}) | ({
|
|
51
49
|
recommendationIdentifier: {
|
|
52
|
-
[x: string]: unknown;
|
|
53
50
|
key: string;
|
|
54
51
|
algorithm: string;
|
|
55
52
|
};
|
|
56
53
|
recommendationReturnType: "productSearchResultItem";
|
|
57
54
|
product: {
|
|
58
|
-
[x: string]: unknown;
|
|
59
55
|
identifier: {
|
|
60
|
-
[x: string]: unknown;
|
|
61
56
|
key: string;
|
|
62
57
|
};
|
|
63
58
|
name: string;
|
|
64
59
|
slug: string;
|
|
65
60
|
variants: {
|
|
66
|
-
[x: string]: unknown;
|
|
67
61
|
variant: {
|
|
68
|
-
[x: string]: unknown;
|
|
69
62
|
sku: string;
|
|
70
63
|
};
|
|
71
64
|
image: {
|
|
72
|
-
[x: string]: unknown;
|
|
73
65
|
sourceUrl: string;
|
|
74
66
|
altText: string;
|
|
75
67
|
width?: number | undefined;
|
|
76
68
|
height?: number | undefined;
|
|
77
69
|
};
|
|
78
70
|
options?: {
|
|
79
|
-
[x: string]: unknown;
|
|
80
71
|
identifier: {
|
|
81
|
-
[x: string]: unknown;
|
|
82
72
|
key: string;
|
|
83
73
|
};
|
|
84
74
|
name: string;
|
|
85
75
|
value: {
|
|
86
|
-
[x: string]: unknown;
|
|
87
76
|
identifier: {
|
|
88
|
-
[x: string]: unknown;
|
|
89
77
|
option: {
|
|
90
|
-
[x: string]: unknown;
|
|
91
78
|
key: string;
|
|
92
79
|
};
|
|
93
80
|
key: string;
|
|
@@ -97,7 +84,9 @@ export declare class AlgoliaProductRecommendationsProvider extends ProductRecomm
|
|
|
97
84
|
} | undefined;
|
|
98
85
|
}[];
|
|
99
86
|
};
|
|
100
|
-
}
|
|
87
|
+
} & {
|
|
88
|
+
_?: never;
|
|
89
|
+
}))[];
|
|
101
90
|
/**
|
|
102
91
|
* Maps Algolia recommendation results to ProductRecommendation format
|
|
103
92
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import z from "zod";
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const AlgoliaProductSearchIdentifierSchema: z.ZodObject<{
|
|
3
3
|
key: z.ZodString;
|
|
4
4
|
algorithm: z.ZodString;
|
|
5
5
|
abTestID: z.ZodOptional<z.ZodNumber>;
|
|
6
6
|
abTestVariantID: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
}, z.
|
|
7
|
+
}, z.core.$loose>;
|
|
8
8
|
export type AlgoliaProductRecommendationIdentifier = z.infer<typeof AlgoliaProductSearchIdentifierSchema>;
|