@wix/auto_sdk_restaurants_recommendations 1.0.0 → 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.
- package/build/cjs/index.d.ts +3 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +31 -11
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +26 -7
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +3 -2
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +31 -11
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +26 -7
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +3 -2
- package/build/internal/cjs/index.typings.d.ts +31 -11
- package/build/internal/cjs/meta.d.ts +26 -7
- package/build/internal/es/index.d.mts +3 -2
- package/build/internal/es/index.typings.d.mts +31 -11
- package/build/internal/es/meta.d.mts +26 -7
- package/package.json +2 -2
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../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":["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":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,IAAM,oBAAoB;AAAA,EACxB,EAAE,MAAM,yCAAyC;AAAA,EACjD,EAAE,MAAM,uCAAuC;AACjD;AAEA,SAAS,wEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAwBd,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,iBAAiB,eAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AACD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK;AAAA,QACH,EAAE,WAAW,2BAA2B,MAAM,gB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Aa,YAAY,MAAM;AAE/B,WAAO;AAAA,MACLN,gBAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAOC;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,aAAa;AAAA,UACb,UAAU;AAAA,UACV,OAAO;AAAA,UACP,iBAAiB;AAAA,UACjB,aAAa;AAAA,UACb,OAAO;AAAA,QACT;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,eAAe,SAAS;AAAA,IAC3B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEzXO,SAASM,oBACd,YAC6B;AAC7B,SAAO,CACL,aACA,YAgBAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,SAAS,wBAAwB;AAG1B,IAAMC,sBAGK,iCAAiBA,mBAAwB;","names":["transformPaths","TRANSFORM_PATHS_0","RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations","getRecommendations","getRecommendations"]}
|
|
1
|
+
{"version":3,"sources":["../../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":["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":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,IAAM,oBAAoB;AAAA,EACxB,EAAE,MAAM,yCAAyC;AAAA,EACjD,EAAE,MAAM,uCAAuC;AACjD;AAEA,SAAS,wEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,yBAAyB;AAA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WAAW;AAAA,EACf;AACJ;;;ACnCA,SAAS,wBAAwB;AAG1B,IAAMC,sBAGK,iCAAiBA,mBAAwB;","names":["transformPaths","TRANSFORM_PATHS_0","RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations","getRecommendations","getRecommendations"]}
|
|
@@ -56,8 +56,8 @@ interface GetRecommendationsRequest {
|
|
|
56
56
|
*/
|
|
57
57
|
operationId: string;
|
|
58
58
|
/**
|
|
59
|
-
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
60
|
-
* Recommendation Settings as is.
|
|
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
61
|
*/
|
|
62
62
|
strategy: RecommendationStrategy;
|
|
63
63
|
/**
|
|
@@ -89,19 +89,30 @@ interface GetRecommendationsRequest {
|
|
|
89
89
|
}
|
|
90
90
|
/** How recommended items are selected. */
|
|
91
91
|
interface RecommendationStrategy extends RecommendationStrategyOptionsOneOf {
|
|
92
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Options for the `FEATURED` strategy.
|
|
94
|
+
*
|
|
95
|
+
* Required when `type` is `FEATURED`.
|
|
96
|
+
*/
|
|
93
97
|
featuredOptions?: FeaturedOptions;
|
|
94
98
|
/** Strategy type. */
|
|
95
99
|
type?: RecommendationStrategyTypeWithLiterals;
|
|
96
100
|
}
|
|
97
101
|
/** @oneof */
|
|
98
102
|
interface RecommendationStrategyOptionsOneOf {
|
|
99
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Options for the `FEATURED` strategy.
|
|
105
|
+
*
|
|
106
|
+
* Required when `type` is `FEATURED`.
|
|
107
|
+
*/
|
|
100
108
|
featuredOptions?: FeaturedOptions;
|
|
101
109
|
}
|
|
102
110
|
/** Method for selecting recommended items. */
|
|
103
111
|
declare enum RecommendationStrategyType {
|
|
104
|
-
/**
|
|
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
|
+
*/
|
|
105
116
|
FREQUENTLY_ORDERED_TOGETHER = "FREQUENTLY_ORDERED_TOGETHER",
|
|
106
117
|
/**
|
|
107
118
|
* Items ordered most often from the operation, based on its order history. Not related to the `BEST_SELLER` featured
|
|
@@ -151,7 +162,11 @@ declare enum FeaturedType {
|
|
|
151
162
|
type FeaturedTypeWithLiterals = FeaturedType | 'POPULAR' | 'BEST_SELLER' | 'NEW' | 'CHEF_SPECIAL' | 'RECOMMENDED' | 'SEASONAL' | 'FEATURED';
|
|
152
163
|
/** Fulfillment method and timing. */
|
|
153
164
|
interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
|
|
154
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Time window of a scheduled order.
|
|
167
|
+
*
|
|
168
|
+
* Required when `timing` is `SCHEDULED`.
|
|
169
|
+
*/
|
|
155
170
|
scheduledOptions?: ScheduledOptions;
|
|
156
171
|
/** Fulfillment method. */
|
|
157
172
|
type?: FulfillmentTypeWithLiterals;
|
|
@@ -160,7 +175,11 @@ interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
|
|
|
160
175
|
}
|
|
161
176
|
/** @oneof */
|
|
162
177
|
interface FulfillmentDetailsTimingOptionsOneOf {
|
|
163
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Time window of a scheduled order.
|
|
180
|
+
*
|
|
181
|
+
* Required when `timing` is `SCHEDULED`.
|
|
182
|
+
*/
|
|
164
183
|
scheduledOptions?: ScheduledOptions;
|
|
165
184
|
}
|
|
166
185
|
/** Fulfillment method. */
|
|
@@ -208,8 +227,9 @@ interface GetRecommendationsResponse {
|
|
|
208
227
|
/**
|
|
209
228
|
* Retrieves menu items to recommend to a customer who's ordering from an operation.
|
|
210
229
|
*
|
|
211
|
-
* Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call
|
|
212
|
-
* Recommendation Settings
|
|
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
|
|
213
233
|
* check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
|
|
214
234
|
* `enabled` value is `true`.
|
|
215
235
|
*
|
|
@@ -247,8 +267,8 @@ interface GetRecommendationsResponse {
|
|
|
247
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>>;
|
|
248
268
|
interface GetRecommendationsOptions {
|
|
249
269
|
/**
|
|
250
|
-
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
251
|
-
* Recommendation Settings as is.
|
|
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.
|
|
252
272
|
*/
|
|
253
273
|
strategy: RecommendationStrategy;
|
|
254
274
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.http.ts"],"sourcesContent":["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"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,IAAM,oBAAoB;AAAA,EACxB,EAAE,MAAM,yCAAyC;AAAA,EACjD,EAAE,MAAM,uCAAuC;AACjD;AAEA,SAAS,wEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAwBd,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,iBAAiB,eAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO;AAAA,MACT;AAAA,IACF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B,SAAS;AAAA,IAC1B,aAAa,SAAS;AAAA,IACtB,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UAC4D;AAAA,IAC9D;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO;AAAA,MACLN,gBAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAOC;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,aAAa;AAAA,UACb,UAAU;AAAA,UACV,OAAO;AAAA,UACP,iBAAiB;AAAA,UACjB,aAAa;AAAA,UACb,OAAO;AAAA,QACT;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,eAAe,SAAS;AAAA,IAC3B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["transformPaths","TRANSFORM_PATHS_0","RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations"]}
|
|
1
|
+
{"version":3,"sources":["../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.http.ts"],"sourcesContent":["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"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,IAAM,oBAAoB;AAAA,EACxB,EAAE,MAAM,yCAAyC;AAAA,EACjD,EAAE,MAAM,uCAAuC;AACjD;AAEA,SAAS,wEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAyBd,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,iBAAiB,eAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO;AAAA,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AA,IAChB,iBAAiB,SAAS;AAAA,IAC1B,aAAa,SAAS;AAAA,IACtB,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UAC4D;AAAA,IAC9D;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO;AAAA,MACLN,gBAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAOC;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,aAAa;AAAA,UACb,UAAU;AAAA,UACV,OAAO;AAAA,UACP,iBAAiB;AAAA,UACjB,aAAa;AAAA,UACb,OAAO;AAAA,QACT;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,eAAe,SAAS;AAAA,IAC3B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["transformPaths","TRANSFORM_PATHS_0","RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations"]}
|
package/build/es/meta.d.mts
CHANGED
|
@@ -75,8 +75,8 @@ interface GetRecommendationsRequest {
|
|
|
75
75
|
*/
|
|
76
76
|
operationId: string;
|
|
77
77
|
/**
|
|
78
|
-
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
79
|
-
* Recommendation Settings as is.
|
|
78
|
+
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
79
|
+
* [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.
|
|
80
80
|
*/
|
|
81
81
|
strategy: RecommendationStrategy;
|
|
82
82
|
/**
|
|
@@ -108,19 +108,30 @@ interface GetRecommendationsRequest {
|
|
|
108
108
|
}
|
|
109
109
|
/** How recommended items are selected. */
|
|
110
110
|
interface RecommendationStrategy extends RecommendationStrategyOptionsOneOf {
|
|
111
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Options for the `FEATURED` strategy.
|
|
113
|
+
*
|
|
114
|
+
* Required when `type` is `FEATURED`.
|
|
115
|
+
*/
|
|
112
116
|
featuredOptions?: FeaturedOptions;
|
|
113
117
|
/** Strategy type. */
|
|
114
118
|
type?: RecommendationStrategyTypeWithLiterals;
|
|
115
119
|
}
|
|
116
120
|
/** @oneof */
|
|
117
121
|
interface RecommendationStrategyOptionsOneOf {
|
|
118
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Options for the `FEATURED` strategy.
|
|
124
|
+
*
|
|
125
|
+
* Required when `type` is `FEATURED`.
|
|
126
|
+
*/
|
|
119
127
|
featuredOptions?: FeaturedOptions;
|
|
120
128
|
}
|
|
121
129
|
/** Method for selecting recommended items. */
|
|
122
130
|
declare enum RecommendationStrategyType {
|
|
123
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Items that customers often order together with the items specified in `items` when calling
|
|
133
|
+
* [Get Recommendations](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendations/get-recommendations).
|
|
134
|
+
*/
|
|
124
135
|
FREQUENTLY_ORDERED_TOGETHER = "FREQUENTLY_ORDERED_TOGETHER",
|
|
125
136
|
/**
|
|
126
137
|
* Items ordered most often from the operation, based on its order history. Not related to the `BEST_SELLER` featured
|
|
@@ -170,7 +181,11 @@ declare enum FeaturedType {
|
|
|
170
181
|
type FeaturedTypeWithLiterals = FeaturedType | 'POPULAR' | 'BEST_SELLER' | 'NEW' | 'CHEF_SPECIAL' | 'RECOMMENDED' | 'SEASONAL' | 'FEATURED';
|
|
171
182
|
/** Fulfillment method and timing. */
|
|
172
183
|
interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
|
|
173
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* Time window of a scheduled order.
|
|
186
|
+
*
|
|
187
|
+
* Required when `timing` is `SCHEDULED`.
|
|
188
|
+
*/
|
|
174
189
|
scheduledOptions?: ScheduledOptions;
|
|
175
190
|
/** Fulfillment method. */
|
|
176
191
|
type?: FulfillmentTypeWithLiterals;
|
|
@@ -179,7 +194,11 @@ interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
|
|
|
179
194
|
}
|
|
180
195
|
/** @oneof */
|
|
181
196
|
interface FulfillmentDetailsTimingOptionsOneOf {
|
|
182
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Time window of a scheduled order.
|
|
199
|
+
*
|
|
200
|
+
* Required when `timing` is `SCHEDULED`.
|
|
201
|
+
*/
|
|
183
202
|
scheduledOptions?: ScheduledOptions;
|
|
184
203
|
}
|
|
185
204
|
/** Fulfillment method. */
|
package/build/es/meta.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.http.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.types.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.meta.ts"],"sourcesContent":["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","/**\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?: Image;\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 Image {\n /** WixMedia image ID. */\n id?: string;\n /** Image URL. */\n url?: string;\n /**\n * Original image height.\n * @readonly\n */\n height?: number;\n /**\n * Original image width.\n * @readonly\n */\n width?: number;\n /** Image alt text. */\n altText?: string | null;\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","import * as ambassadorWixRestaurantsOrderingRecommendationsV1Recommendation from './restaurants-ordering-recommendations-v1-recommendation-recommendations.http.js';\nimport * as ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationTypes from './restaurants-ordering-recommendations-v1-recommendation-recommendations.types.js';\nimport * as ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationUniversalTypes from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function getRecommendations(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationUniversalTypes.GetRecommendationsRequest,\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationTypes.GetRecommendationsRequest,\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationUniversalTypes.GetRecommendationsResponse,\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationTypes.GetRecommendationsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixRestaurantsOrderingRecommendationsV1Recommendation.getRecommendations(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/recommendations/get',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Recommendation as RecommendationOriginal,\n ItemReference as ItemReferenceOriginal,\n Image as ImageOriginal,\n GetRecommendationsRequest as GetRecommendationsRequestOriginal,\n RecommendationStrategy as RecommendationStrategyOriginal,\n RecommendationStrategyOptionsOneOf as RecommendationStrategyOptionsOneOfOriginal,\n RecommendationStrategyType as RecommendationStrategyTypeOriginal,\n RecommendationStrategyTypeWithLiterals as RecommendationStrategyTypeWithLiteralsOriginal,\n FeaturedOptions as FeaturedOptionsOriginal,\n FeaturedInfo as FeaturedInfoOriginal,\n FeaturedType as FeaturedTypeOriginal,\n FeaturedTypeWithLiterals as FeaturedTypeWithLiteralsOriginal,\n FulfillmentDetails as FulfillmentDetailsOriginal,\n FulfillmentDetailsTimingOptionsOneOf as FulfillmentDetailsTimingOptionsOneOfOriginal,\n FulfillmentType as FulfillmentTypeOriginal,\n FulfillmentTypeWithLiterals as FulfillmentTypeWithLiteralsOriginal,\n FulfillmentTiming as FulfillmentTimingOriginal,\n FulfillmentTimingWithLiterals as FulfillmentTimingWithLiteralsOriginal,\n ScheduledOptions as ScheduledOptionsOriginal,\n GetRecommendationsResponse as GetRecommendationsResponseOriginal,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.types.js';\n"],"mappings":";AAAA,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,IAAM,oBAAoB;AAAA,EACxB,EAAE,MAA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c;AAEd,EAAAA,cAAA,SAAM;AAEN,EAAAA,cAAA,kBAAe;AAEf,EAAAA,cAAA,iBAAc;AAEd,EAAAA,cAAA,cAAW;AAKX,EAAAA,cAAA,cAAW;AAjBD,SAAAA;AAAA,GAAA;AAiDL,IAAK,kBAAL,kBAAKC,qBAAL;AAEL,EAAAA,iBAAA,YAAS;AAET,EAAAA,iBAAA,cAAW;AAEX,EAAAA,iBAAA,aAAU;AANA,SAAAA;AAAA,GAAA;AAiBL,IAAK,oBAAL,kBAAKC,uBAAL;AAEL,EAAAA,mBAAA,UAAO;AAEP,EAAAA,mBAAA,eAAY;AAJF,SAAAA;AAAA,GAAA;;;ACnNL,SAASC,sBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC4D;AAAA,IAC9D;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations"]}
|
|
1
|
+
{"version":3,"sources":["../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.http.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.types.ts","../../src/restaurants-ordering-recommendations-v1-recommendation-recommendations.meta.ts"],"sourcesContent":["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","/**\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?: Image;\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 Image {\n /** WixMedia image ID. */\n id?: string;\n /** Image URL. */\n url?: string;\n /**\n * Original image height.\n * @readonly\n */\n height?: number;\n /**\n * Original image width.\n * @readonly\n */\n width?: number;\n /** Image alt text. */\n altText?: string | null;\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","import * as ambassadorWixRestaurantsOrderingRecommendationsV1Recommendation from './restaurants-ordering-recommendations-v1-recommendation-recommendations.http.js';\nimport * as ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationTypes from './restaurants-ordering-recommendations-v1-recommendation-recommendations.types.js';\nimport * as ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationUniversalTypes from './restaurants-ordering-recommendations-v1-recommendation-recommendations.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function getRecommendations(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationUniversalTypes.GetRecommendationsRequest,\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationTypes.GetRecommendationsRequest,\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationUniversalTypes.GetRecommendationsResponse,\n ambassadorWixRestaurantsOrderingRecommendationsV1RecommendationTypes.GetRecommendationsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixRestaurantsOrderingRecommendationsV1Recommendation.getRecommendations(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/recommendations/get',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Recommendation as RecommendationOriginal,\n ItemReference as ItemReferenceOriginal,\n Image as ImageOriginal,\n GetRecommendationsRequest as GetRecommendationsRequestOriginal,\n RecommendationStrategy as RecommendationStrategyOriginal,\n RecommendationStrategyOptionsOneOf as RecommendationStrategyOptionsOneOfOriginal,\n RecommendationStrategyType as RecommendationStrategyTypeOriginal,\n RecommendationStrategyTypeWithLiterals as RecommendationStrategyTypeWithLiteralsOriginal,\n FeaturedOptions as FeaturedOptionsOriginal,\n FeaturedInfo as FeaturedInfoOriginal,\n FeaturedType as FeaturedTypeOriginal,\n FeaturedTypeWithLiterals as FeaturedTypeWithLiteralsOriginal,\n FulfillmentDetails as FulfillmentDetailsOriginal,\n FulfillmentDetailsTimingOptionsOneOf as FulfillmentDetailsTimingOptionsOneOfOriginal,\n FulfillmentType as FulfillmentTypeOriginal,\n FulfillmentTypeWithLiterals as FulfillmentTypeWithLiteralsOriginal,\n FulfillmentTiming as FulfillmentTimingOriginal,\n FulfillmentTimingWithLiterals as FulfillmentTimingWithLiteralsOriginal,\n ScheduledOptions as ScheduledOptionsOriginal,\n GetRecommendationsResponse as GetRecommendationsResponseOriginal,\n} from './restaurants-ordering-recommendations-v1-recommendation-recommendations.types.js';\n"],"mappings":";AAAA,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,IAAM,oBAAoB;AAAA,EACxB,EAAE,MAAM,yCAAyC;AAAA,EACjD,EAAE,MAAM,uCAAuC;AACjD;AAEA,SAAS,wEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAyBd,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,iBAAiB,eAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AACD,UAAM,WAAW;AAAA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B;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["RecommendationStrategyType","FeaturedType","FulfillmentType","FulfillmentTiming","getRecommendations"]}
|
|
@@ -7,8 +7,9 @@ interface GetRecommendationsSignature {
|
|
|
7
7
|
/**
|
|
8
8
|
* Retrieves menu items to recommend to a customer who's ordering from an operation.
|
|
9
9
|
*
|
|
10
|
-
* Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call
|
|
11
|
-
* Recommendation Settings
|
|
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
|
|
12
13
|
* check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
|
|
13
14
|
* `enabled` value is `true`.
|
|
14
15
|
*
|
|
@@ -62,8 +62,8 @@ interface GetRecommendationsRequest {
|
|
|
62
62
|
*/
|
|
63
63
|
operationId: string;
|
|
64
64
|
/**
|
|
65
|
-
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
66
|
-
* Recommendation Settings as is.
|
|
65
|
+
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
66
|
+
* [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.
|
|
67
67
|
*/
|
|
68
68
|
strategy: RecommendationStrategy;
|
|
69
69
|
/**
|
|
@@ -95,19 +95,30 @@ interface GetRecommendationsRequest {
|
|
|
95
95
|
}
|
|
96
96
|
/** How recommended items are selected. */
|
|
97
97
|
interface RecommendationStrategy extends RecommendationStrategyOptionsOneOf {
|
|
98
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Options for the `FEATURED` strategy.
|
|
100
|
+
*
|
|
101
|
+
* Required when `type` is `FEATURED`.
|
|
102
|
+
*/
|
|
99
103
|
featuredOptions?: FeaturedOptions;
|
|
100
104
|
/** Strategy type. */
|
|
101
105
|
type?: RecommendationStrategyTypeWithLiterals;
|
|
102
106
|
}
|
|
103
107
|
/** @oneof */
|
|
104
108
|
interface RecommendationStrategyOptionsOneOf {
|
|
105
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Options for the `FEATURED` strategy.
|
|
111
|
+
*
|
|
112
|
+
* Required when `type` is `FEATURED`.
|
|
113
|
+
*/
|
|
106
114
|
featuredOptions?: FeaturedOptions;
|
|
107
115
|
}
|
|
108
116
|
/** Method for selecting recommended items. */
|
|
109
117
|
declare enum RecommendationStrategyType {
|
|
110
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Items that customers often order together with the items specified in `items` when calling
|
|
120
|
+
* [Get Recommendations](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendations/get-recommendations).
|
|
121
|
+
*/
|
|
111
122
|
FREQUENTLY_ORDERED_TOGETHER = "FREQUENTLY_ORDERED_TOGETHER",
|
|
112
123
|
/**
|
|
113
124
|
* Items ordered most often from the operation, based on its order history. Not related to the `BEST_SELLER` featured
|
|
@@ -157,7 +168,11 @@ declare enum FeaturedType {
|
|
|
157
168
|
type FeaturedTypeWithLiterals = FeaturedType | 'POPULAR' | 'BEST_SELLER' | 'NEW' | 'CHEF_SPECIAL' | 'RECOMMENDED' | 'SEASONAL' | 'FEATURED';
|
|
158
169
|
/** Fulfillment method and timing. */
|
|
159
170
|
interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
|
|
160
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* Time window of a scheduled order.
|
|
173
|
+
*
|
|
174
|
+
* Required when `timing` is `SCHEDULED`.
|
|
175
|
+
*/
|
|
161
176
|
scheduledOptions?: ScheduledOptions;
|
|
162
177
|
/** Fulfillment method. */
|
|
163
178
|
type?: FulfillmentTypeWithLiterals;
|
|
@@ -166,7 +181,11 @@ interface FulfillmentDetails extends FulfillmentDetailsTimingOptionsOneOf {
|
|
|
166
181
|
}
|
|
167
182
|
/** @oneof */
|
|
168
183
|
interface FulfillmentDetailsTimingOptionsOneOf {
|
|
169
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* Time window of a scheduled order.
|
|
186
|
+
*
|
|
187
|
+
* Required when `timing` is `SCHEDULED`.
|
|
188
|
+
*/
|
|
170
189
|
scheduledOptions?: ScheduledOptions;
|
|
171
190
|
}
|
|
172
191
|
/** Fulfillment method. */
|
|
@@ -214,8 +233,9 @@ interface GetRecommendationsResponse {
|
|
|
214
233
|
/**
|
|
215
234
|
* Retrieves menu items to recommend to a customer who's ordering from an operation.
|
|
216
235
|
*
|
|
217
|
-
* Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call
|
|
218
|
-
* Recommendation Settings
|
|
236
|
+
* Recommended items are selected according to `strategy`. To use the strategy the restaurant chose, call
|
|
237
|
+
* [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings)
|
|
238
|
+
* and specify the returned strategy for the relevant placement as is. This method doesn't
|
|
219
239
|
* check whether recommendations are enabled in the recommendation settings, so call it only when the relevant
|
|
220
240
|
* `enabled` value is `true`.
|
|
221
241
|
*
|
|
@@ -253,8 +273,8 @@ interface GetRecommendationsResponse {
|
|
|
253
273
|
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>>;
|
|
254
274
|
interface GetRecommendationsOptions {
|
|
255
275
|
/**
|
|
256
|
-
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
257
|
-
* Recommendation Settings as is.
|
|
276
|
+
* How to select recommended items. To use the strategy the restaurant chose, specify a strategy returned by
|
|
277
|
+
* [Get Recommendation Settings](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/recommendations/recommendation-settings/get-recommendation-settings) as is.
|
|
258
278
|
*/
|
|
259
279
|
strategy: RecommendationStrategy;
|
|
260
280
|
/**
|