@wix/auto_sdk_restaurants_recommendations 0.0.0-stage → 1.0.0

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,36 @@
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 Get
11
+ * Recommendation Settings and specify the returned strategy for the relevant placement as is. This method doesn't
12
+ * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
13
+ * `enabled` value is `true`.
14
+ *
15
+ * The items specified in `items` are the items the recommendations are based on, such as the item the customer is
16
+ * viewing or the items in their cart. These items affect which items are recommended, and are never returned
17
+ * themselves. To leave items out of the results without affecting which items are recommended, specify them in
18
+ * `excludedItemIds`.
19
+ *
20
+ * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that
21
+ * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a
22
+ * menu that the operation offers for online ordering. An item's availability is checked again when the order is
23
+ * placed.
24
+ *
25
+ * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,
26
+ * so they may return an empty list for a site with few orders. The method also returns an empty list when the
27
+ * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.
28
+ * @param - ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to
29
+ * this operation.
30
+ */
31
+ (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>>;
32
+ }
33
+
34
+ declare const getRecommendations: MaybeContext<BuildRESTFunction<typeof getRecommendations$1> & typeof getRecommendations$1>;
35
+
36
+ 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 Get\n * 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 /** Options for the `FEATURED` strategy. Required when `type` is `FEATURED`. */\n featuredOptions?: FeaturedOptions;\n /** Strategy type. */\n type?: RecommendationStrategyTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface RecommendationStrategyOptionsOneOf {\n /** Options for the `FEATURED` strategy. Required when `type` is `FEATURED`. */\n featuredOptions?: FeaturedOptions;\n}\n\n/** Method for selecting recommended items. */\nexport enum RecommendationStrategyType {\n /** Items that customers often order together with the items specified in `items` when calling Get Recommendations. */\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 /** Time window of a scheduled order. Required when `timing` is `SCHEDULED`. */\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 /** Time window of a scheduled order. Required when `timing` is `SCHEDULED`. */\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 Get\n * Recommendation Settings 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 Get\n * 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 Get\n * Recommendation Settings 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 Get\n * Recommendation Settings 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,282 @@
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 Get
60
+ * 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
+ /** Options for the `FEATURED` strategy. Required when `type` is `FEATURED`. */
93
+ featuredOptions?: FeaturedOptions;
94
+ /** Strategy type. */
95
+ type?: RecommendationStrategyTypeWithLiterals;
96
+ }
97
+ /** @oneof */
98
+ interface RecommendationStrategyOptionsOneOf {
99
+ /** Options for the `FEATURED` strategy. Required when `type` is `FEATURED`. */
100
+ featuredOptions?: FeaturedOptions;
101
+ }
102
+ /** Method for selecting recommended items. */
103
+ declare enum RecommendationStrategyType {
104
+ /** Items that customers often order together with the items specified in `items` when calling Get Recommendations. */
105
+ FREQUENTLY_ORDERED_TOGETHER = "FREQUENTLY_ORDERED_TOGETHER",
106
+ /**
107
+ * Items ordered most often from the operation, based on its order history. Not related to the `BEST_SELLER` featured
108
+ * type.
109
+ */
110
+ BEST_SELLERS = "BEST_SELLERS",
111
+ /** Items that have any of the featured types specified in `featuredOptions.featuredInfos`. */
112
+ FEATURED = "FEATURED"
113
+ }
114
+ /** @enumType */
115
+ type RecommendationStrategyTypeWithLiterals = RecommendationStrategyType | 'FREQUENTLY_ORDERED_TOGETHER' | 'BEST_SELLERS' | 'FEATURED';
116
+ /** Options for the `FEATURED` strategy. */
117
+ interface FeaturedOptions {
118
+ /**
119
+ * Featured types to match. A menu item is recommended when it has any of these featured types.
120
+ * @minSize 1
121
+ * @maxSize 7
122
+ */
123
+ featuredInfos?: FeaturedInfo[];
124
+ }
125
+ /** Reason an item is featured, as set on the menu item. */
126
+ interface FeaturedInfo {
127
+ /** Featured type. */
128
+ type?: FeaturedTypeWithLiterals;
129
+ }
130
+ /** Type indicating why an item is featured. */
131
+ declare enum FeaturedType {
132
+ /** Popular item. */
133
+ POPULAR = "POPULAR",
134
+ /** Best seller. */
135
+ BEST_SELLER = "BEST_SELLER",
136
+ /** New item. */
137
+ NEW = "NEW",
138
+ /** Chef's special. */
139
+ CHEF_SPECIAL = "CHEF_SPECIAL",
140
+ /** Recommended item. */
141
+ RECOMMENDED = "RECOMMENDED",
142
+ /** Seasonal item. */
143
+ SEASONAL = "SEASONAL",
144
+ /**
145
+ * General featured label set on the menu item. Not the same as the `FEATURED` strategy type, which recommends
146
+ * items that have any of the specified featured types.
147
+ */
148
+ FEATURED = "FEATURED"
149
+ }
150
+ /** @enumType */
151
+ type FeaturedTypeWithLiterals = FeaturedType | 'POPULAR' | 'BEST_SELLER' | 'NEW' | 'CHEF_SPECIAL' | 'RECOMMENDED' | 'SEASONAL' | 'FEATURED';
152
+ /** Fulfillment method and timing. */
153
+ interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
154
+ /** Time window of a scheduled order. Required when `timing` is `SCHEDULED`. */
155
+ scheduledOptions?: ScheduledOptions;
156
+ /** Fulfillment method. */
157
+ type?: FulfillmentTypeWithLiterals;
158
+ /** When the order is to be fulfilled. */
159
+ timing?: FulfillmentTimingWithLiterals;
160
+ }
161
+ /** @oneof */
162
+ interface FulfillmentDetailsTimingOptionsOneOf {
163
+ /** Time window of a scheduled order. Required when `timing` is `SCHEDULED`. */
164
+ scheduledOptions?: ScheduledOptions;
165
+ }
166
+ /** Fulfillment method. */
167
+ declare enum FulfillmentType {
168
+ /** The customer picks up the order from the restaurant. */
169
+ PICKUP = "PICKUP",
170
+ /** The order is delivered to the customer. */
171
+ DELIVERY = "DELIVERY",
172
+ /** The customer eats the order at the restaurant. */
173
+ DINE_IN = "DINE_IN"
174
+ }
175
+ /** @enumType */
176
+ type FulfillmentTypeWithLiterals = FulfillmentType | 'PICKUP' | 'DELIVERY' | 'DINE_IN';
177
+ /** Fulfillment timing. */
178
+ declare enum FulfillmentTiming {
179
+ /** The order is fulfilled as soon as possible. */
180
+ ASAP = "ASAP",
181
+ /** The order is fulfilled within the time window specified in `scheduledOptions`. */
182
+ SCHEDULED = "SCHEDULED"
183
+ }
184
+ /** @enumType */
185
+ type FulfillmentTimingWithLiterals = FulfillmentTiming | 'ASAP' | 'SCHEDULED';
186
+ /** Time window for a scheduled order. */
187
+ interface ScheduledOptions {
188
+ /** Start of the time window. */
189
+ startTime?: Date | null;
190
+ /** End of the time window. Can't be earlier than `startTime`. */
191
+ endTime?: Date | null;
192
+ }
193
+ interface GetRecommendationsResponse {
194
+ /**
195
+ * Recommended items, most relevant first. Empty when there are no items to recommend.
196
+ * @maxSize 10
197
+ */
198
+ recommendations?: Recommendation[];
199
+ /**
200
+ * Currency of the returned prices. Three-letter currency code in
201
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
202
+ *
203
+ * Empty when there are no recommendations.
204
+ * @format CURRENCY
205
+ */
206
+ currencyCode?: string;
207
+ }
208
+ /**
209
+ * Retrieves menu items to recommend to a customer who's ordering from an operation.
210
+ *
211
+ * Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call Get
212
+ * Recommendation Settings and specify the returned strategy for the relevant placement as is. This method doesn't
213
+ * check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
214
+ * `enabled` value is `true`.
215
+ *
216
+ * The items specified in `items` are the items the recommendations are based on, such as the item the customer is
217
+ * viewing or the items in their cart. These items affect which items are recommended, and are never returned
218
+ * themselves. To leave items out of the results without affecting which items are recommended, specify them in
219
+ * `excludedItemIds`.
220
+ *
221
+ * Only items that the customer can currently order with the specified `fulfillment` are returned. This means that
222
+ * each returned item is visible, in stock, has a price, and is available for the fulfillment method and time, in a
223
+ * menu that the operation offers for online ordering. An item's availability is checked again when the order is
224
+ * placed.
225
+ *
226
+ * The `FREQUENTLY_ORDERED_TOGETHER` and `BEST_SELLERS` strategies are based on the operation's recent order history,
227
+ * so they may return an empty list for a site with few orders. The method also returns an empty list when the
228
+ * operation can't fulfill an order with the specified `fulfillment`, or when there are no items to recommend.
229
+ * @param operationId - ID of the operation the customer is ordering from. The items specified in `items` and the returned items belong to
230
+ * this operation.
231
+ * @public
232
+ * @documentationMaturity preview
233
+ * @requiredField operationId
234
+ * @requiredField options.fulfillment
235
+ * @requiredField options.fulfillment.timing
236
+ * @requiredField options.fulfillment.type
237
+ * @requiredField options.items.itemId
238
+ * @requiredField options.items.menuId
239
+ * @requiredField options.items.sectionId
240
+ * @requiredField options.strategy
241
+ * @requiredField options.strategy.featuredOptions.featuredInfos
242
+ * @requiredField options.strategy.type
243
+ * @permissionId restaurants:ordering_recommendations:v1:recommendation:get_recommendations
244
+ * @applicableIdentity APP
245
+ * @fqn wix.restaurants.ordering_recommendations.v1.RecommendationsService.GetRecommendations
246
+ */
247
+ 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>>;
248
+ interface GetRecommendationsOptions {
249
+ /**
250
+ * How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by Get
251
+ * Recommendation Settings as is.
252
+ */
253
+ strategy: RecommendationStrategy;
254
+ /**
255
+ * Items to base the recommendations on, such as the item the customer is viewing or the items in their cart. These
256
+ * items are never recommended.
257
+ *
258
+ * Required for the `FREQUENTLY_ORDERED_TOGETHER` strategy to return recommendations. Can be empty for `BEST_SELLERS`
259
+ * and `FEATURED`.
260
+ * @maxSize 300
261
+ */
262
+ items?: ItemReference[];
263
+ /**
264
+ * IDs of menu items to leave out of the results. Unlike `items`, these items don't affect which items are
265
+ * recommended.
266
+ * @maxSize 300
267
+ * @format GUID
268
+ */
269
+ excludedItemIds?: string[];
270
+ /** Fulfillment method and timing the customer selected. Only items available for this fulfillment are recommended. */
271
+ fulfillment: FulfillmentDetails;
272
+ /**
273
+ * Maximum number of recommendations to return.
274
+ *
275
+ * Default: `10`
276
+ * @min 1
277
+ * @max 10
278
+ */
279
+ limit?: number | null;
280
+ }
281
+
282
+ 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 };