@wix/auto_sdk_restaurants_recommendations 0.0.0-stage → 1.0.1

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.
@@ -0,0 +1,37 @@
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
+ import { GetRecommendationsOptions, GetRecommendationsResponse } from './index.typings.js';
3
+ export { FeaturedInfo, FeaturedOptions, FeaturedType, FeaturedTypeWithLiterals, FulfillmentDetails, FulfillmentDetailsTimingOptionsOneOf, FulfillmentTiming, FulfillmentTimingWithLiterals, FulfillmentType, FulfillmentTypeWithLiterals, GetRecommendationsRequest, ItemReference, Recommendation, RecommendationStrategy, RecommendationStrategyOptionsOneOf, RecommendationStrategyType, RecommendationStrategyTypeWithLiterals, ScheduledOptions } from './index.typings.js';
4
+
5
+ declare function getRecommendations$1(httpClient: HttpClient): GetRecommendationsSignature;
6
+ interface GetRecommendationsSignature {
7
+ /**
8
+ * Retrieves menu items to recommend to a customer who's ordering from an operation.
9
+ *
10
+ * Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call
11
+ * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings)
12
+ * and specify the returned strategy for the relevant placement as is. This method doesn't
13
+ * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
14
+ * `enabled` value is `true`.
15
+ *
16
+ * The items specified in `items` are the items the recommendations are based on, such as the item the customer is
17
+ * viewing or the items in their cart. These items affect which items are recommended, and are never returned
18
+ * themselves. To leave items out of the results without affecting which items are recommended, specify them in
19
+ * `excludedItemIds`.
20
+ *
21
+ * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that
22
+ * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a
23
+ * menu that the operation offers for online ordering. An item's availability is checked again when the order is
24
+ * placed.
25
+ *
26
+ * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,
27
+ * so they may return an empty list for a site with few orders. The method also returns an empty list when the
28
+ * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.
29
+ * @param - ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to
30
+ * this operation.
31
+ */
32
+ (operationId: string, options?: NonNullablePaths<GetRecommendationsOptions, `fulfillment` | `fulfillment.scheduledOptions.endTime` | `fulfillment.scheduledOptions.startTime` | `fulfillment.timing` | `fulfillment.type` | `items.${number}.itemId` | `items.${number}.menuId` | `items.${number}.sectionId` | `strategy` | `strategy.featuredOptions.featuredInfos` | `strategy.type`, 2>): Promise<NonNullablePaths<GetRecommendationsResponse, `recommendations` | `recommendations.${number}.item.itemId` | `recommendations.${number}.item.menuId` | `recommendations.${number}.item.sectionId` | `recommendations.${number}.name` | `recommendations.${number}.price` | `currencyCode`, 3>>;
33
+ }
34
+
35
+ declare const getRecommendations: MaybeContext<BuildRESTFunction<typeof getRecommendations$1> & typeof getRecommendations$1>;
36
+
37
+ export { GetRecommendationsOptions, GetRecommendationsResponse, getRecommendations };
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ FeaturedType: () => FeaturedType,
24
+ FulfillmentTiming: () => FulfillmentTiming,
25
+ FulfillmentType: () => FulfillmentType,
26
+ RecommendationStrategyType: () => RecommendationStrategyType,
27
+ getRecommendations: () => getRecommendations4
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+
31
+ // src/restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.ts
32
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
33
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
34
+
35
+ // src/restaurants-ordering-recommendations-v1-recommendation-recommendations.http.ts
36
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
37
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
38
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
39
+ var TRANSFORM_PATHS_0 = [
40
+ { path: "fulfillment.scheduledOptions.startTime" },
41
+ { path: "fulfillment.scheduledOptions.endTime" }
42
+ ];
43
+ function resolveWixRestaurantsOrderingRecommendationsV1RecommendationsServiceUrl(opts) {
44
+ const domainToMappings = {
45
+ _: [
46
+ {
47
+ srcPath: "/_api/ordering-recommendations",
48
+ destPath: ""
49
+ }
50
+ ],
51
+ "apps._base_domain_": [
52
+ {
53
+ srcPath: "/_api/ordering-recommendations",
54
+ destPath: ""
55
+ }
56
+ ],
57
+ "api._api_base_domain_": [
58
+ {
59
+ srcPath: "/ordering-recommendations",
60
+ destPath: ""
61
+ }
62
+ ],
63
+ "www.wixapis.com": [
64
+ {
65
+ srcPath: "/restaurants/ordering-recommendations/v1/recommendations",
66
+ destPath: "/v1/recommendations"
67
+ }
68
+ ]
69
+ };
70
+ return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
71
+ }
72
+ var PACKAGE_NAME = "@wix/auto_sdk_restaurants_recommendations";
73
+ function getRecommendations(payload) {
74
+ function __getRecommendations({ host }) {
75
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
76
+ {
77
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
78
+ paths: TRANSFORM_PATHS_0
79
+ }
80
+ ]);
81
+ const metadata = {
82
+ entityFqdn: "wix.restaurants.ordering_recommendations.v1.recommendation",
83
+ method: "POST",
84
+ methodFqn: "wix.restaurants.ordering_recommendations.v1.RecommendationsService.GetRecommendations",
85
+ packageName: PACKAGE_NAME,
86
+ migrationOptions: {
87
+ optInTransformResponse: true
88
+ },
89
+ url: resolveWixRestaurantsOrderingRecommendationsV1RecommendationsServiceUrl(
90
+ { protoPath: "/v1/recommendations/get", data: serializedData, host }
91
+ ),
92
+ data: serializedData
93
+ };
94
+ return metadata;
95
+ }
96
+ return __getRecommendations;
97
+ }
98
+
99
+ // src/restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.ts
100
+ var import_image = require("@wix/sdk-runtime/transformations/image");
101
+ var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
102
+ var TRANSFORM_PATHS_02 = [{ path: "recommendations.image" }];
103
+ var RecommendationStrategyType = /* @__PURE__ */ ((RecommendationStrategyType2) => {
104
+ RecommendationStrategyType2["FREQUENTLY_ORDERED_TOGETHER"] = "FREQUENTLY_ORDERED_TOGETHER";
105
+ RecommendationStrategyType2["BEST_SELLERS"] = "BEST_SELLERS";
106
+ RecommendationStrategyType2["FEATURED"] = "FEATURED";
107
+ return RecommendationStrategyType2;
108
+ })(RecommendationStrategyType || {});
109
+ var FeaturedType = /* @__PURE__ */ ((FeaturedType2) => {
110
+ FeaturedType2["POPULAR"] = "POPULAR";
111
+ FeaturedType2["BEST_SELLER"] = "BEST_SELLER";
112
+ FeaturedType2["NEW"] = "NEW";
113
+ FeaturedType2["CHEF_SPECIAL"] = "CHEF_SPECIAL";
114
+ FeaturedType2["RECOMMENDED"] = "RECOMMENDED";
115
+ FeaturedType2["SEASONAL"] = "SEASONAL";
116
+ FeaturedType2["FEATURED"] = "FEATURED";
117
+ return FeaturedType2;
118
+ })(FeaturedType || {});
119
+ var FulfillmentType = /* @__PURE__ */ ((FulfillmentType2) => {
120
+ FulfillmentType2["PICKUP"] = "PICKUP";
121
+ FulfillmentType2["DELIVERY"] = "DELIVERY";
122
+ FulfillmentType2["DINE_IN"] = "DINE_IN";
123
+ return FulfillmentType2;
124
+ })(FulfillmentType || {});
125
+ var FulfillmentTiming = /* @__PURE__ */ ((FulfillmentTiming2) => {
126
+ FulfillmentTiming2["ASAP"] = "ASAP";
127
+ FulfillmentTiming2["SCHEDULED"] = "SCHEDULED";
128
+ return FulfillmentTiming2;
129
+ })(FulfillmentTiming || {});
130
+ async function getRecommendations2(operationId, options) {
131
+ const { httpClient, sideEffects } = arguments[2];
132
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
133
+ operationId,
134
+ strategy: options?.strategy,
135
+ items: options?.items,
136
+ excludedItemIds: options?.excludedItemIds,
137
+ fulfillment: options?.fulfillment,
138
+ limit: options?.limit
139
+ });
140
+ const reqOpts = getRecommendations(
141
+ payload
142
+ );
143
+ sideEffects?.onSiteCall?.();
144
+ try {
145
+ const result = await httpClient.request(reqOpts);
146
+ sideEffects?.onSuccess?.(result);
147
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
148
+ (0, import_transform_paths2.transformPaths)(result.data, [
149
+ {
150
+ transformFn: import_image.transformRESTImageToSDKImage,
151
+ paths: TRANSFORM_PATHS_02
152
+ }
153
+ ])
154
+ );
155
+ } catch (err) {
156
+ const transformedError = (0, import_transform_error.transformError)(
157
+ err,
158
+ {
159
+ spreadPathsToArguments: {},
160
+ explicitPathsToArguments: {
161
+ operationId: "$[0]",
162
+ strategy: "$[1].strategy",
163
+ items: "$[1].items",
164
+ excludedItemIds: "$[1].excludedItemIds",
165
+ fulfillment: "$[1].fulfillment",
166
+ limit: "$[1].limit"
167
+ },
168
+ singleArgumentUnchanged: false
169
+ },
170
+ ["operationId", "options"]
171
+ );
172
+ sideEffects?.onError?.(err);
173
+ throw transformedError;
174
+ }
175
+ }
176
+
177
+ // src/restaurants-ordering-recommendations-v1-recommendation-recommendations.public.ts
178
+ function getRecommendations3(httpClient) {
179
+ return (operationId, options) => getRecommendations2(
180
+ operationId,
181
+ options,
182
+ // @ts-ignore
183
+ { httpClient }
184
+ );
185
+ }
186
+
187
+ // src/restaurants-ordering-recommendations-v1-recommendation-recommendations.context.ts
188
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
189
+ var getRecommendations4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getRecommendations3);
190
+ // Annotate the CommonJS export names for ESM import in node:
191
+ 0 && (module.exports = {
192
+ FeaturedType,
193
+ FulfillmentTiming,
194
+ FulfillmentType,
195
+ RecommendationStrategyType,
196
+ getRecommendations
197
+ });
198
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.http.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.public.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.context.ts"],"sourcesContent":["export * from './src/restaurants-ordering-recommendations-v1-recommendation-recommendations.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRestaurantsOrderingRecommendationsV1Recommendation from './restaurants-ordering-recommendations-v1-recommendation-recommendations.http.js';\nimport { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nconst TRANSFORM_PATHS_0 = [{ path: 'recommendations.image' }];\n\n/**\n * A recommendation is a menu item suggested to a customer to add to their restaurant order. For example, a drink\n * recommended to a customer who's ordering a pizza.\n *\n * Recommendations are calculated for each request and aren't stored, so a recommendation has no ID. Each\n * recommendation includes the details needed to display the item, such as its name, image, and price.\n */\nexport interface Recommendation {\n /** Reference to the recommended menu item, including the menu and section it's in. */\n item?: ItemReference;\n /**\n * Name of the recommended item.\n * @minLength 1\n * @maxLength 200\n */\n name?: string;\n /**\n * Description of the recommended item.\n * @maxLength 1500\n */\n description?: string | null;\n /** Main image of the recommended item. */\n image?: string;\n /**\n * Price of the recommended item, in the currency returned in `currencyCode`. This is the item's base price,\n * without modifiers. For an item with price variants, this is the lowest variant price.\n * @decimalValue options { gte:0.00, maxScale:3 }\n */\n price?: string;\n /**\n * Whether the item can be added to the order as is. `false` when the item has price variants or any modifier\n * groups, including optional ones. When `false`, open the item's details to add it.\n * @internal\n */\n quickAddEligible?: boolean;\n}\n\n/** Reference to a menu item in a specific menu and section. */\nexport interface ItemReference {\n /**\n * Menu item ID.\n * @format GUID\n */\n itemId?: string;\n /**\n * ID of the menu the item is in.\n * @format GUID\n */\n menuId?: string;\n /**\n * ID of the menu section the item is in.\n * @format GUID\n */\n sectionId?: string;\n}\n\nexport interface GetRecommendationsRequest {\n /**\n * ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to\n * this operation.\n * @format GUID\n */\n operationId: string;\n /**\n * How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by\n * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.\n */\n strategy: RecommendationStrategy;\n /**\n * Items to base the recommendations on, such as the item the customer is viewing or the items in their cart. These\n * items are never recommended.\n *\n * Required for the `FREQUENTLY_ORDERED_TOGETHER` strategy to return recommendations. Can be empty for `BEST_SELLERS`\n * and `FEATURED`.\n * @maxSize 300\n */\n items?: ItemReference[];\n /**\n * IDs of menu items to leave out of the results. Unlike `items`, these items don't affect which items are\n * recommended.\n * @maxSize 300\n * @format GUID\n */\n excludedItemIds?: string[];\n /** Fulfillment method and timing the customer selected. Only items available for this fulfillment are recommended. */\n fulfillment: FulfillmentDetails;\n /**\n * Maximum number of recommendations to return.\n *\n * Default: `10`\n * @min 1\n * @max 10\n */\n limit?: number | null;\n}\n\n/** How recommended items are selected. */\nexport interface RecommendationStrategy\n extends RecommendationStrategyOptionsOneOf {\n /**\n * Options for the `FEATURED` strategy.\n *\n * Required when `type` is `FEATURED`.\n */\n featuredOptions?: FeaturedOptions;\n /** Strategy type. */\n type?: RecommendationStrategyTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface RecommendationStrategyOptionsOneOf {\n /**\n * Options for the `FEATURED` strategy.\n *\n * Required when `type` is `FEATURED`.\n */\n featuredOptions?: FeaturedOptions;\n}\n\n/** Method for selecting recommended items. */\nexport enum RecommendationStrategyType {\n /**\n * Items that customers often order together with the items specified in `items` when calling\n * [Get Recommendations](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendations/get-recommendations).\n */\n FREQUENTLY_ORDERED_TOGETHER = 'FREQUENTLY_ORDERED_TOGETHER',\n /**\n * Items ordered most often from the operation, based on its order history. Not related to the `BEST_SELLER` featured\n * type.\n */\n BEST_SELLERS = 'BEST_SELLERS',\n /** Items that have any of the featured types specified in `featuredOptions.featuredInfos`. */\n FEATURED = 'FEATURED',\n}\n\n/** @enumType */\nexport type RecommendationStrategyTypeWithLiterals =\n | RecommendationStrategyType\n | 'FREQUENTLY_ORDERED_TOGETHER'\n | 'BEST_SELLERS'\n | 'FEATURED';\n\n/** Options for the `FEATURED` strategy. */\nexport interface FeaturedOptions {\n /**\n * Featured types to match. A menu item is recommended when it has any of these featured types.\n * @minSize 1\n * @maxSize 7\n */\n featuredInfos?: FeaturedInfo[];\n}\n\n/** Reason an item is featured, as set on the menu item. */\nexport interface FeaturedInfo {\n /** Featured type. */\n type?: FeaturedTypeWithLiterals;\n}\n\n/** Type indicating why an item is featured. */\nexport enum FeaturedType {\n /** Popular item. */\n POPULAR = 'POPULAR',\n /** Best seller. */\n BEST_SELLER = 'BEST_SELLER',\n /** New item. */\n NEW = 'NEW',\n /** Chef's special. */\n CHEF_SPECIAL = 'CHEF_SPECIAL',\n /** Recommended item. */\n RECOMMENDED = 'RECOMMENDED',\n /** Seasonal item. */\n SEASONAL = 'SEASONAL',\n /**\n * General featured label set on the menu item. Not the same as the `FEATURED` strategy type, which recommends\n * items that have any of the specified featured types.\n */\n FEATURED = 'FEATURED',\n}\n\n/** @enumType */\nexport type FeaturedTypeWithLiterals =\n | FeaturedType\n | 'POPULAR'\n | 'BEST_SELLER'\n | 'NEW'\n | 'CHEF_SPECIAL'\n | 'RECOMMENDED'\n | 'SEASONAL'\n | 'FEATURED';\n\n/** Fulfillment method and timing. */\nexport interface FulfillmentDetails\n extends FulfillmentDetailsTimingOptionsOneOf {\n /**\n * Time window of a scheduled order.\n *\n * Required when `timing` is `SCHEDULED`.\n */\n scheduledOptions?: ScheduledOptions;\n /** Fulfillment method. */\n type?: FulfillmentTypeWithLiterals;\n /** When the order is to be fulfilled. */\n timing?: FulfillmentTimingWithLiterals;\n}\n\n/** @oneof */\nexport interface FulfillmentDetailsTimingOptionsOneOf {\n /**\n * Time window of a scheduled order.\n *\n * Required when `timing` is `SCHEDULED`.\n */\n scheduledOptions?: ScheduledOptions;\n}\n\n/** Fulfillment method. */\nexport enum FulfillmentType {\n /** The customer picks up the order from the restaurant. */\n PICKUP = 'PICKUP',\n /** The order is delivered to the customer. */\n DELIVERY = 'DELIVERY',\n /** The customer eats the order at the restaurant. */\n DINE_IN = 'DINE_IN',\n}\n\n/** @enumType */\nexport type FulfillmentTypeWithLiterals =\n | FulfillmentType\n | 'PICKUP'\n | 'DELIVERY'\n | 'DINE_IN';\n\n/** Fulfillment timing. */\nexport enum FulfillmentTiming {\n /** The order is fulfilled as soon as possible. */\n ASAP = 'ASAP',\n /** The order is fulfilled within the time window specified in `scheduledOptions`. */\n SCHEDULED = 'SCHEDULED',\n}\n\n/** @enumType */\nexport type FulfillmentTimingWithLiterals =\n | FulfillmentTiming\n | 'ASAP'\n | 'SCHEDULED';\n\n/** Time window for a scheduled order. */\nexport interface ScheduledOptions {\n /** Start of the time window. */\n startTime?: Date | null;\n /** End of the time window. Can't be earlier than `startTime`. */\n endTime?: Date | null;\n}\n\nexport interface GetRecommendationsResponse {\n /**\n * Recommended items, most relevant first. Empty when there are no items to recommend.\n * @maxSize 10\n */\n recommendations?: Recommendation[];\n /**\n * Currency of the returned prices. Three-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n *\n * Empty when there are no recommendations.\n * @format CURRENCY\n */\n currencyCode?: string;\n}\n\n/**\n * Retrieves menu items to recommend to a customer who's ordering from an operation.\n *\n * Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call\n * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings)\n * and specify the returned strategy for the relevant placement as is. This method doesn't\n * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant\n * `enabled` value is `true`.\n *\n * The items specified in `items` are the items the recommendations are based on, such as the item the customer is\n * viewing or the items in their cart. These items affect which items are recommended, and are never returned\n * themselves. To leave items out of the results without affecting which items are recommended, specify them in\n * `excludedItemIds`.\n *\n * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that\n * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a\n * menu that the operation offers for online ordering. An item's availability is checked again when the order is\n * placed.\n *\n * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,\n * so they may return an empty list for a site with few orders. The method also returns an empty list when the\n * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.\n * @param operationId - ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to\n * this operation.\n * @public\n * @documentationMaturity preview\n * @requiredField operationId\n * @requiredField options.fulfillment\n * @requiredField options.fulfillment.timing\n * @requiredField options.fulfillment.type\n * @requiredField options.items.itemId\n * @requiredField options.items.menuId\n * @requiredField options.items.sectionId\n * @requiredField options.strategy\n * @requiredField options.strategy.featuredOptions.featuredInfos\n * @requiredField options.strategy.type\n * @permissionId restaurants:ordering_recommendations:v1:recommendation:get_recommendations\n * @applicableIdentity APP\n * @fqn wix.restaurants.ordering_recommendations.v1.RecommendationsService.GetRecommendations\n */\nexport async function getRecommendations(\n operationId: string,\n options?: NonNullablePaths<\n GetRecommendationsOptions,\n | `fulfillment`\n | `fulfillment.scheduledOptions.endTime`\n | `fulfillment.scheduledOptions.startTime`\n | `fulfillment.timing`\n | `fulfillment.type`\n | `items.${number}.itemId`\n | `items.${number}.menuId`\n | `items.${number}.sectionId`\n | `strategy`\n | `strategy.featuredOptions.featuredInfos`\n | `strategy.type`,\n 2\n >\n): Promise<\n NonNullablePaths<\n GetRecommendationsResponse,\n | `recommendations`\n | `recommendations.${number}.item.itemId`\n | `recommendations.${number}.item.menuId`\n | `recommendations.${number}.item.sectionId`\n | `recommendations.${number}.name`\n | `recommendations.${number}.price`\n | `currencyCode`,\n 3\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n operationId: operationId,\n strategy: options?.strategy,\n items: options?.items,\n excludedItemIds: options?.excludedItemIds,\n fulfillment: options?.fulfillment,\n limit: options?.limit,\n });\n\n const reqOpts =\n ambassadorWixRestaurantsOrderingRecommendationsV1Recommendation.getRecommendations(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTImageToSDKImage,\n paths: TRANSFORM_PATHS_0,\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n operationId: '$[0]',\n strategy: '$[1].strategy',\n items: '$[1].items',\n excludedItemIds: '$[1].excludedItemIds',\n fulfillment: '$[1].fulfillment',\n limit: '$[1].limit',\n },\n singleArgumentUnchanged: false,\n },\n ['operationId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetRecommendationsOptions {\n /**\n * How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by\n * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.\n */\n strategy: RecommendationStrategy;\n /**\n * Items to base the recommendations on, such as the item the customer is viewing or the items in their cart. These\n * items are never recommended.\n *\n * Required for the `FREQUENTLY_ORDERED_TOGETHER` strategy to return recommendations. Can be empty for `BEST_SELLERS`\n * and `FEATURED`.\n * @maxSize 300\n */\n items?: ItemReference[];\n /**\n * IDs of menu items to leave out of the results. Unlike `items`, these items don't affect which items are\n * recommended.\n * @maxSize 300\n * @format GUID\n */\n excludedItemIds?: string[];\n /** Fulfillment method and timing the customer selected. Only items available for this fulfillment are recommended. */\n fulfillment: FulfillmentDetails;\n /**\n * Maximum number of recommendations to return.\n *\n * Default: `10`\n * @min 1\n * @max 10\n */\n limit?: number | null;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nconst TRANSFORM_PATHS_0 = [\n { path: 'fulfillment.scheduledOptions.startTime' },\n { path: 'fulfillment.scheduledOptions.endTime' },\n];\n\nfunction resolveWixRestaurantsOrderingRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n _: [\n {\n srcPath: '/_api/ordering-recommendations',\n destPath: '',\n },\n ],\n 'apps._base_domain_': [\n {\n srcPath: '/_api/ordering-recommendations',\n destPath: '',\n },\n ],\n 'api._api_base_domain_': [\n {\n srcPath: '/ordering-recommendations',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/restaurants/ordering-recommendations/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_restaurants_recommendations';\n\n/**\n * Retrieves menu items to recommend to a customer who's ordering from an operation.\n *\n * Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call\n * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings)\n * and specify the returned strategy for the relevant placement as is. This method doesn't\n * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant\n * `enabled` value is `true`.\n *\n * The items specified in `items` are the items the recommendations are based on, such as the item the customer is\n * viewing or the items in their cart. These items affect which items are recommended, and are never returned\n * themselves. To leave items out of the results without affecting which items are recommended, specify them in\n * `excludedItemIds`.\n *\n * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that\n * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a\n * menu that the operation offers for online ordering. An item's availability is checked again when the order is\n * placed.\n *\n * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,\n * so they may return an empty list for a site with few orders. The method also returns an empty list when the\n * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.\n */\nexport function getRecommendations(\n payload: object\n): RequestOptionsFactory<any> {\n function __getRecommendations({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: TRANSFORM_PATHS_0,\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.restaurants.ordering_recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'wix.restaurants.ordering_recommendations.v1.RecommendationsService.GetRecommendations',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixRestaurantsOrderingRecommendationsV1RecommendationsServiceUrl(\n { protoPath: '/v1/recommendations/get', data: serializedData, host }\n ),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __getRecommendations;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n GetRecommendationsOptions,\n GetRecommendationsResponse,\n getRecommendations as universalGetRecommendations,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/restaurants' };\n\nexport function getRecommendations(\n httpClient: HttpClient\n): GetRecommendationsSignature {\n return (\n operationId: string,\n options?: NonNullablePaths<\n GetRecommendationsOptions,\n | `fulfillment`\n | `fulfillment.scheduledOptions.endTime`\n | `fulfillment.scheduledOptions.startTime`\n | `fulfillment.timing`\n | `fulfillment.type`\n | `items.${number}.itemId`\n | `items.${number}.menuId`\n | `items.${number}.sectionId`\n | `strategy`\n | `strategy.featuredOptions.featuredInfos`\n | `strategy.type`,\n 2\n >\n ) =>\n universalGetRecommendations(\n operationId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetRecommendationsSignature {\n /**\n * Retrieves menu items to recommend to a customer who's ordering from an operation.\n *\n * Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call\n * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings)\n * and specify the returned strategy for the relevant placement as is. This method doesn't\n * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant\n * `enabled` value is `true`.\n *\n * The items specified in `items` are the items the recommendations are based on, such as the item the customer is\n * viewing or the items in their cart. These items affect which items are recommended, and are never returned\n * themselves. To leave items out of the results without affecting which items are recommended, specify them in\n * `excludedItemIds`.\n *\n * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that\n * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a\n * menu that the operation offers for online ordering. An item's availability is checked again when the order is\n * placed.\n *\n * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,\n * so they may return an empty list for a site with few orders. The method also returns an empty list when the\n * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.\n * @param - ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to\n * this operation.\n */\n (\n operationId: string,\n options?: NonNullablePaths<\n GetRecommendationsOptions,\n | `fulfillment`\n | `fulfillment.scheduledOptions.endTime`\n | `fulfillment.scheduledOptions.startTime`\n | `fulfillment.timing`\n | `fulfillment.type`\n | `items.${number}.itemId`\n | `items.${number}.menuId`\n | `items.${number}.sectionId`\n | `strategy`\n | `strategy.featuredOptions.featuredInfos`\n | `strategy.type`,\n 2\n >\n ): Promise<\n NonNullablePaths<\n GetRecommendationsResponse,\n | `recommendations`\n | `recommendations.${number}.item.itemId`\n | `recommendations.${number}.item.menuId`\n | `recommendations.${number}.item.sectionId`\n | `recommendations.${number}.name`\n | `recommendations.${number}.price`\n | `currencyCode`,\n 3\n >\n >;\n}\n\nexport {\n FeaturedInfo,\n FeaturedOptions,\n FeaturedType,\n FulfillmentDetails,\n FulfillmentDetailsTimingOptionsOneOf,\n FulfillmentTiming,\n FulfillmentType,\n GetRecommendationsOptions,\n GetRecommendationsRequest,\n GetRecommendationsResponse,\n ItemReference,\n Recommendation,\n RecommendationStrategy,\n RecommendationStrategyOptionsOneOf,\n RecommendationStrategyType,\n ScheduledOptions,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\n","import { getRecommendations as publicGetRecommendations } from './restaurants-ordering-recommendations-v1-recommendation-recommendations.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const getRecommendations: MaybeContext<\n BuildRESTFunction<typeof publicGetRecommendations> &\n typeof publicGetRecommendations\n> = /*#__PURE__*/ createRESTModule(publicGetRecommendations);\n\nexport {\n RecommendationStrategyType,\n FeaturedType,\n FulfillmentType,\n FulfillmentTiming,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\nexport {\n Recommendation,\n ItemReference,\n GetRecommendationsRequest,\n RecommendationStrategy,\n RecommendationStrategyOptionsOneOf,\n FeaturedOptions,\n FeaturedInfo,\n FulfillmentDetails,\n FulfillmentDetailsTimingOptionsOneOf,\n ScheduledOptions,\n GetRecommendationsResponse,\n GetRecommendationsOptions,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\nexport {\n RecommendationStrategyTypeWithLiterals,\n FeaturedTypeWithLiterals,\n FulfillmentTypeWithLiterals,\n FulfillmentTimingWithLiterals,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\n"],"mappings":"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","names":["getRecommendations","import_transform_paths","TRANSFORM_PATHS_0","RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations","sdkTransformError","getRecommendations","import_rest_modules","getRecommendations"]}
@@ -0,0 +1,302 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
3
+ /**
4
+ * A recommendation is a menu item suggested to a customer to add to their restaurant order. For example, a drink
5
+ * recommended to a customer who's ordering a pizza.
6
+ *
7
+ * Recommendations are calculated for each request and aren't stored, so a recommendation has no ID. Each
8
+ * recommendation includes the details needed to display the item, such as its name, image, and price.
9
+ */
10
+ interface Recommendation {
11
+ /** Reference to the recommended menu item, including the menu and section it's in. */
12
+ item?: ItemReference;
13
+ /**
14
+ * Name of the recommended item.
15
+ * @minLength 1
16
+ * @maxLength 200
17
+ */
18
+ name?: string;
19
+ /**
20
+ * Description of the recommended item.
21
+ * @maxLength 1500
22
+ */
23
+ description?: string | null;
24
+ /** Main image of the recommended item. */
25
+ image?: string;
26
+ /**
27
+ * Price of the recommended item, in the currency returned in `currencyCode`. This is the item's base price,
28
+ * without modifiers. For an item with price variants, this is the lowest variant price.
29
+ * @decimalValue options { gte:0.00, maxScale:3 }
30
+ */
31
+ price?: string;
32
+ }
33
+ /** Reference to a menu item in a specific menu and section. */
34
+ interface ItemReference {
35
+ /**
36
+ * Menu item ID.
37
+ * @format GUID
38
+ */
39
+ itemId?: string;
40
+ /**
41
+ * ID of the menu the item is in.
42
+ * @format GUID
43
+ */
44
+ menuId?: string;
45
+ /**
46
+ * ID of the menu section the item is in.
47
+ * @format GUID
48
+ */
49
+ sectionId?: string;
50
+ }
51
+ interface GetRecommendationsRequest {
52
+ /**
53
+ * ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to
54
+ * this operation.
55
+ * @format GUID
56
+ */
57
+ operationId: string;
58
+ /**
59
+ * How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
60
+ * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.
61
+ */
62
+ strategy: RecommendationStrategy;
63
+ /**
64
+ * Items to base the recommendations on, such as the item the customer is viewing or the items in their cart. These
65
+ * items are never recommended.
66
+ *
67
+ * Required for the `FREQUENTLY_ORDERED_TOGETHER` strategy to return recommendations. Can be empty for `BEST_SELLERS`
68
+ * and `FEATURED`.
69
+ * @maxSize 300
70
+ */
71
+ items?: ItemReference[];
72
+ /**
73
+ * IDs of menu items to leave out of the results. Unlike `items`, these items don't affect which items are
74
+ * recommended.
75
+ * @maxSize 300
76
+ * @format GUID
77
+ */
78
+ excludedItemIds?: string[];
79
+ /** Fulfillment method and timing the customer selected. Only items available for this fulfillment are recommended. */
80
+ fulfillment: FulfillmentDetails;
81
+ /**
82
+ * Maximum number of recommendations to return.
83
+ *
84
+ * Default: `10`
85
+ * @min 1
86
+ * @max 10
87
+ */
88
+ limit?: number | null;
89
+ }
90
+ /** How recommended items are selected. */
91
+ interface RecommendationStrategy extends RecommendationStrategyOptionsOneOf {
92
+ /**
93
+ * Options for the `FEATURED` strategy.
94
+ *
95
+ * Required when `type` is `FEATURED`.
96
+ */
97
+ featuredOptions?: FeaturedOptions;
98
+ /** Strategy type. */
99
+ type?: RecommendationStrategyTypeWithLiterals;
100
+ }
101
+ /** @oneof */
102
+ interface RecommendationStrategyOptionsOneOf {
103
+ /**
104
+ * Options for the `FEATURED` strategy.
105
+ *
106
+ * Required when `type` is `FEATURED`.
107
+ */
108
+ featuredOptions?: FeaturedOptions;
109
+ }
110
+ /** Method for selecting recommended items. */
111
+ declare enum RecommendationStrategyType {
112
+ /**
113
+ * Items that customers often order together with the items specified in `items` when calling
114
+ * [Get Recommendations](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendations/get-recommendations).
115
+ */
116
+ FREQUENTLY_ORDERED_TOGETHER = "FREQUENTLY_ORDERED_TOGETHER",
117
+ /**
118
+ * Items ordered most often from the operation, based on its order history. Not related to the `BEST_SELLER` featured
119
+ * type.
120
+ */
121
+ BEST_SELLERS = "BEST_SELLERS",
122
+ /** Items that have any of the featured types specified in `featuredOptions.featuredInfos`. */
123
+ FEATURED = "FEATURED"
124
+ }
125
+ /** @enumType */
126
+ type RecommendationStrategyTypeWithLiterals = RecommendationStrategyType | 'FREQUENTLY_ORDERED_TOGETHER' | 'BEST_SELLERS' | 'FEATURED';
127
+ /** Options for the `FEATURED` strategy. */
128
+ interface FeaturedOptions {
129
+ /**
130
+ * Featured types to match. A menu item is recommended when it has any of these featured types.
131
+ * @minSize 1
132
+ * @maxSize 7
133
+ */
134
+ featuredInfos?: FeaturedInfo[];
135
+ }
136
+ /** Reason an item is featured, as set on the menu item. */
137
+ interface FeaturedInfo {
138
+ /** Featured type. */
139
+ type?: FeaturedTypeWithLiterals;
140
+ }
141
+ /** Type indicating why an item is featured. */
142
+ declare enum FeaturedType {
143
+ /** Popular item. */
144
+ POPULAR = "POPULAR",
145
+ /** Best seller. */
146
+ BEST_SELLER = "BEST_SELLER",
147
+ /** New item. */
148
+ NEW = "NEW",
149
+ /** Chef's special. */
150
+ CHEF_SPECIAL = "CHEF_SPECIAL",
151
+ /** Recommended item. */
152
+ RECOMMENDED = "RECOMMENDED",
153
+ /** Seasonal item. */
154
+ SEASONAL = "SEASONAL",
155
+ /**
156
+ * General featured label set on the menu item. Not the same as the `FEATURED` strategy type, which recommends
157
+ * items that have any of the specified featured types.
158
+ */
159
+ FEATURED = "FEATURED"
160
+ }
161
+ /** @enumType */
162
+ type FeaturedTypeWithLiterals = FeaturedType | 'POPULAR' | 'BEST_SELLER' | 'NEW' | 'CHEF_SPECIAL' | 'RECOMMENDED' | 'SEASONAL' | 'FEATURED';
163
+ /** Fulfillment method and timing. */
164
+ interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
165
+ /**
166
+ * Time window of a scheduled order.
167
+ *
168
+ * Required when `timing` is `SCHEDULED`.
169
+ */
170
+ scheduledOptions?: ScheduledOptions;
171
+ /** Fulfillment method. */
172
+ type?: FulfillmentTypeWithLiterals;
173
+ /** When the order is to be fulfilled. */
174
+ timing?: FulfillmentTimingWithLiterals;
175
+ }
176
+ /** @oneof */
177
+ interface FulfillmentDetailsTimingOptionsOneOf {
178
+ /**
179
+ * Time window of a scheduled order.
180
+ *
181
+ * Required when `timing` is `SCHEDULED`.
182
+ */
183
+ scheduledOptions?: ScheduledOptions;
184
+ }
185
+ /** Fulfillment method. */
186
+ declare enum FulfillmentType {
187
+ /** The customer picks up the order from the restaurant. */
188
+ PICKUP = "PICKUP",
189
+ /** The order is delivered to the customer. */
190
+ DELIVERY = "DELIVERY",
191
+ /** The customer eats the order at the restaurant. */
192
+ DINE_IN = "DINE_IN"
193
+ }
194
+ /** @enumType */
195
+ type FulfillmentTypeWithLiterals = FulfillmentType | 'PICKUP' | 'DELIVERY' | 'DINE_IN';
196
+ /** Fulfillment timing. */
197
+ declare enum FulfillmentTiming {
198
+ /** The order is fulfilled as soon as possible. */
199
+ ASAP = "ASAP",
200
+ /** The order is fulfilled within the time window specified in `scheduledOptions`. */
201
+ SCHEDULED = "SCHEDULED"
202
+ }
203
+ /** @enumType */
204
+ type FulfillmentTimingWithLiterals = FulfillmentTiming | 'ASAP' | 'SCHEDULED';
205
+ /** Time window for a scheduled order. */
206
+ interface ScheduledOptions {
207
+ /** Start of the time window. */
208
+ startTime?: Date | null;
209
+ /** End of the time window. Can't be earlier than `startTime`. */
210
+ endTime?: Date | null;
211
+ }
212
+ interface GetRecommendationsResponse {
213
+ /**
214
+ * Recommended items, most relevant first. Empty when there are no items to recommend.
215
+ * @maxSize 10
216
+ */
217
+ recommendations?: Recommendation[];
218
+ /**
219
+ * Currency of the returned prices. Three-letter currency code in
220
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
221
+ *
222
+ * Empty when there are no recommendations.
223
+ * @format CURRENCY
224
+ */
225
+ currencyCode?: string;
226
+ }
227
+ /**
228
+ * Retrieves menu items to recommend to a customer who's ordering from an operation.
229
+ *
230
+ * Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call
231
+ * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings)
232
+ * and specify the returned strategy for the relevant placement as is. This method doesn't
233
+ * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
234
+ * `enabled` value is `true`.
235
+ *
236
+ * The items specified in `items` are the items the recommendations are based on, such as the item the customer is
237
+ * viewing or the items in their cart. These items affect which items are recommended, and are never returned
238
+ * themselves. To leave items out of the results without affecting which items are recommended, specify them in
239
+ * `excludedItemIds`.
240
+ *
241
+ * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that
242
+ * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a
243
+ * menu that the operation offers for online ordering. An item's availability is checked again when the order is
244
+ * placed.
245
+ *
246
+ * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,
247
+ * so they may return an empty list for a site with few orders. The method also returns an empty list when the
248
+ * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.
249
+ * @param operationId - ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to
250
+ * this operation.
251
+ * @public
252
+ * @documentationMaturity preview
253
+ * @requiredField operationId
254
+ * @requiredField options.fulfillment
255
+ * @requiredField options.fulfillment.timing
256
+ * @requiredField options.fulfillment.type
257
+ * @requiredField options.items.itemId
258
+ * @requiredField options.items.menuId
259
+ * @requiredField options.items.sectionId
260
+ * @requiredField options.strategy
261
+ * @requiredField options.strategy.featuredOptions.featuredInfos
262
+ * @requiredField options.strategy.type
263
+ * @permissionId restaurants:ordering_recommendations:v1:recommendation:get_recommendations
264
+ * @applicableIdentity APP
265
+ * @fqn wix.restaurants.ordering_recommendations.v1.RecommendationsService.GetRecommendations
266
+ */
267
+ declare function getRecommendations(operationId: string, options?: NonNullablePaths<GetRecommendationsOptions, `fulfillment` | `fulfillment.scheduledOptions.endTime` | `fulfillment.scheduledOptions.startTime` | `fulfillment.timing` | `fulfillment.type` | `items.${number}.itemId` | `items.${number}.menuId` | `items.${number}.sectionId` | `strategy` | `strategy.featuredOptions.featuredInfos` | `strategy.type`, 2>): Promise<NonNullablePaths<GetRecommendationsResponse, `recommendations` | `recommendations.${number}.item.itemId` | `recommendations.${number}.item.menuId` | `recommendations.${number}.item.sectionId` | `recommendations.${number}.name` | `recommendations.${number}.price` | `currencyCode`, 3>>;
268
+ interface GetRecommendationsOptions {
269
+ /**
270
+ * How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
271
+ * [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.
272
+ */
273
+ strategy: RecommendationStrategy;
274
+ /**
275
+ * Items to base the recommendations on, such as the item the customer is viewing or the items in their cart. These
276
+ * items are never recommended.
277
+ *
278
+ * Required for the `FREQUENTLY_ORDERED_TOGETHER` strategy to return recommendations. Can be empty for `BEST_SELLERS`
279
+ * and `FEATURED`.
280
+ * @maxSize 300
281
+ */
282
+ items?: ItemReference[];
283
+ /**
284
+ * IDs of menu items to leave out of the results. Unlike `items`, these items don't affect which items are
285
+ * recommended.
286
+ * @maxSize 300
287
+ * @format GUID
288
+ */
289
+ excludedItemIds?: string[];
290
+ /** Fulfillment method and timing the customer selected. Only items available for this fulfillment are recommended. */
291
+ fulfillment: FulfillmentDetails;
292
+ /**
293
+ * Maximum number of recommendations to return.
294
+ *
295
+ * Default: `10`
296
+ * @min 1
297
+ * @max 10
298
+ */
299
+ limit?: number | null;
300
+ }
301
+
302
+ export { type FeaturedInfo, type FeaturedOptions, FeaturedType, type FeaturedTypeWithLiterals, type FulfillmentDetails, type FulfillmentDetailsTimingOptionsOneOf, FulfillmentTiming, type FulfillmentTimingWithLiterals, FulfillmentType, type FulfillmentTypeWithLiterals, type GetRecommendationsOptions, type GetRecommendationsRequest, type GetRecommendationsResponse, type ItemReference, type Recommendation, type RecommendationStrategy, type RecommendationStrategyOptionsOneOf, RecommendationStrategyType, type RecommendationStrategyTypeWithLiterals, type ScheduledOptions, getRecommendations };