@wix/auto_sdk_ecom_recommendations 1.0.39 → 1.0.41
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 +1 -4
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +17 -27
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +14 -19
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +1 -4
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +17 -27
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +14 -19
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +1 -4
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +17 -27
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +14 -19
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +1 -4
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +17 -27
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +14 -19
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -41,10 +41,7 @@ interface GetRecommendationSignature {
|
|
|
41
41
|
* 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.
|
|
42
42
|
* 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.
|
|
43
43
|
* 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.
|
|
44
|
-
* @param -
|
|
45
|
-
* See the method description for more information.
|
|
46
|
-
*
|
|
47
|
-
* If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.
|
|
44
|
+
* @param - Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.
|
|
48
45
|
* @param - Get recommendation options.
|
|
49
46
|
*/
|
|
50
47
|
(algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[], options?: NonNullablePaths<GetRecommendationOptions, `items.${number}.appId` | `items.${number}.catalogItemId`, 4>): Promise<NonNullablePaths<GetRecommendationResponse, `recommendation.items` | `recommendation.items.${number}.catalogItemId` | `recommendation.items.${number}.appId` | `recommendation.algorithm._id` | `recommendation.algorithm.appId`, 5> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ecom-recommendations-v1-recommendation-recommendations.universal.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.http.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.public.ts","../../../src/ecom-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 ambassadorWixEcomRecommendationsV1Recommendation from './ecom-recommendations-v1-recommendation-recommendations.http.js';\n\nexport interface Recommendation {\n /**\n * Recommended items.\n * @maxSize 100\n */\n items?: CatalogReference[];\n /** The algorithm used to provide the recommendation. */\n algorithm?: Algorithm;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in `key:value` pairs.\n *\n * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n *\n * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface Algorithm {\n /**\n * Algorithm ID defined by the app providing the algorithm.\n * @format GUID\n */\n _id?: string;\n /**\n * App ID of the Wix or 3rd-party app providing the algorithm.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n}\n\nexport interface ListAvailableAlgorithmsRequest {}\n\nexport interface ListAvailableAlgorithmsResponse {\n /**\n * Algorithms available for use on your Wix site or project. See the method description for more information.\n * @maxSize 500\n */\n availableAlgorithms?: AlgorithmInfo[];\n}\n\nexport interface AlgorithmInfo {\n /** How the algorithm is configured. */\n config?: AlgorithmConfig;\n /**\n * The app ID of the application providing the algorithm.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n /**\n * App IDs of catalogs to which the algorithm can be applied.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minSize 1\n * @maxSize 100\n * @minLength 1\n * @maxLength 36\n */\n catalogAppIds?: string[];\n}\n\nexport interface AlgorithmConfig {\n /**\n * Algorithm name. This value is not translatable.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /**\n * Algorithm description. This describes how the algorithm works and if it has any limitations regarding site content, number of items in the catalog, site traffic, and so on. This value is not translatable.\n * @minLength 1\n * @maxLength 500\n */\n description?: string;\n /**\n * A supplemental `description`. It can be used to help break up and organize information. You can, for example, display this information as a tooltip or as an additional section that is collapsed by default.\n * @minLength 1\n * @maxLength 300\n */\n additionalInfo?: string | null;\n /**\n * Algorithms may have the following types:\n * * `RELATED_ITEMS` - This type of algorithm provides recommendations based on 1 or more other provided items. For example, when an item is added to a cart, the algorithm can suggest other items frequently bought together with that item.\n * * `GLOBAL` - This type of algorithm provides general recommendations based on site or project statistics. For example, bestsellers or new arrivals.\n */\n algorithmType?: AlgorithmTypeWithLiterals;\n /**\n * Algorithm ID. This must be unique for a specific app but does not have to be unique across all apps on the site or in the project.\n * @format GUID\n */\n algorithmId?: string;\n}\n\nexport enum AlgorithmType {\n UNSPECIFIED = 'UNSPECIFIED',\n RELATED_ITEMS = 'RELATED_ITEMS',\n GLOBAL = 'GLOBAL',\n}\n\n/** @enumType */\nexport type AlgorithmTypeWithLiterals =\n | AlgorithmType\n | 'UNSPECIFIED'\n | 'RELATED_ITEMS'\n | 'GLOBAL';\n\nexport interface GetRecommendationRequest {\n /**\n * The set of items for which to get recommendations. Required if the `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * A list of algorithms checked in a specific order determined by their `appID` and their position in the `algorithms` array.\n * See the method description for more information.\n *\n * If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.\n * @minSize 1\n * @maxSize 10\n */\n algorithms: Algorithm[];\n /**\n * The minimum number of items that must be recommended by the algorithm for those items to be returned in the response.\n *\n * Max: `100`\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n\nexport interface GetRecommendationResponse {\n /** An object containing a list of items recommended by 1 of the specified algorithms. The recommendation is empty if none of the specified algorithms recommended enough items. */\n recommendation?: Recommendation;\n}\n\nexport interface ItemAppIdNotSupportedByProvider {\n /**\n * Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the Dev Center.\n * @minSize 1\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms that don't support the requested items.\n * @minSize 1\n * @maxSize 10\n */\n algorithms?: Algorithm[];\n}\n\nexport interface RecommendationAlgorithmNotSupported {\n /**\n * Algorithms not supported by the provider.\n * @minSize 1\n * @maxSize 10\n */\n unsupportedAlgorithms?: Algorithm[];\n}\n\n/** @docsIgnore */\nexport type GetRecommendationApplicationErrors =\n | {\n code?: 'ITEM_APP_ID_NOT_SUPPORTED';\n description?: string;\n data?: ItemAppIdNotSupportedByProvider;\n }\n | {\n code?: 'ALGORITHM_NOT_SUPPORTED';\n description?: string;\n data?: RecommendationAlgorithmNotSupported;\n }\n | {\n code?: 'RECOMMENDATIONS_PROVIDER_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n * @public\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms\n */\nexport async function listAvailableAlgorithms(): Promise<\n NonNullablePaths<\n ListAvailableAlgorithmsResponse,\n | `availableAlgorithms`\n | `availableAlgorithms.${number}.config.name`\n | `availableAlgorithms.${number}.config.description`\n | `availableAlgorithms.${number}.config.algorithmType`\n | `availableAlgorithms.${number}.config.algorithmId`\n | `availableAlgorithms.${number}.appId`,\n 5\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.listAvailableAlgorithms(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n * @param algorithms - A list of algorithms checked in a specific order determined by their `appID` and their position in the `algorithms` array.\n * See the method description for more information.\n *\n * If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.\n * @public\n * @requiredField algorithms\n * @requiredField algorithms._id\n * @requiredField algorithms.appId\n * @requiredField options.items.appId\n * @requiredField options.items.catalogItemId\n * @param options - Get recommendation options.\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation\n */\nexport async function getRecommendation(\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n): Promise<\n NonNullablePaths<\n GetRecommendationResponse,\n | `recommendation.items`\n | `recommendation.items.${number}.catalogItemId`\n | `recommendation.items.${number}.appId`\n | `recommendation.algorithm._id`\n | `recommendation.algorithm.appId`,\n 5\n > & {\n __applicationErrorsType?: GetRecommendationApplicationErrors;\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 algorithms: algorithms,\n items: options?.items,\n minimumRecommendedItems: options?.minimumRecommendedItems,\n });\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.getRecommendation(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n algorithms: '$[0]',\n items: '$[1].items',\n minimumRecommendedItems: '$[1].minimumRecommendedItems',\n },\n singleArgumentUnchanged: false,\n },\n ['algorithms', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetRecommendationOptions {\n /**\n * The set of items for which to get recommendations. Required if the `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * The minimum number of items that must be recommended by the algorithm for those items to be returned in the response.\n *\n * Max: `100`\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n {\n srcPath: '/ecom/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n _: [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/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_ecom_recommendations';\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\nexport function listAvailableAlgorithms(\n payload: object\n): RequestOptionsFactory<any> {\n function __listAvailableAlgorithms({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'GET' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/algorithms',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listAvailableAlgorithms;\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n */\nexport function getRecommendation(payload: object): RequestOptionsFactory<any> {\n function __getRecommendation({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/get',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __getRecommendation;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Algorithm,\n GetRecommendationApplicationErrors,\n GetRecommendationOptions,\n GetRecommendationResponse,\n ListAvailableAlgorithmsResponse,\n getRecommendation as universalGetRecommendation,\n listAvailableAlgorithms as universalListAvailableAlgorithms,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listAvailableAlgorithms(\n httpClient: HttpClient\n): ListAvailableAlgorithmsSignature {\n return () =>\n universalListAvailableAlgorithms(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListAvailableAlgorithmsSignature {\n /**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\n (): Promise<\n NonNullablePaths<\n ListAvailableAlgorithmsResponse,\n | `availableAlgorithms`\n | `availableAlgorithms.${number}.config.name`\n | `availableAlgorithms.${number}.config.description`\n | `availableAlgorithms.${number}.config.algorithmType`\n | `availableAlgorithms.${number}.config.algorithmId`\n | `availableAlgorithms.${number}.appId`,\n 5\n >\n >;\n}\n\nexport function getRecommendation(\n httpClient: HttpClient\n): GetRecommendationSignature {\n return (\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n ) =>\n universalGetRecommendation(\n algorithms,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetRecommendationSignature {\n /**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n * @param - A list of algorithms checked in a specific order determined by their `appID` and their position in the `algorithms` array.\n * See the method description for more information.\n *\n * If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.\n * @param - Get recommendation options.\n */\n (\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n ): Promise<\n NonNullablePaths<\n GetRecommendationResponse,\n | `recommendation.items`\n | `recommendation.items.${number}.catalogItemId`\n | `recommendation.items.${number}.appId`\n | `recommendation.algorithm._id`\n | `recommendation.algorithm.appId`,\n 5\n > & {\n __applicationErrorsType?: GetRecommendationApplicationErrors;\n }\n >;\n}\n\nexport {\n Algorithm,\n AlgorithmConfig,\n AlgorithmInfo,\n AlgorithmType,\n CatalogReference,\n GetRecommendationOptions,\n GetRecommendationRequest,\n GetRecommendationResponse,\n ItemAppIdNotSupportedByProvider,\n ListAvailableAlgorithmsRequest,\n ListAvailableAlgorithmsResponse,\n Recommendation,\n RecommendationAlgorithmNotSupported,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\n","import {\n listAvailableAlgorithms as publicListAvailableAlgorithms,\n getRecommendation as publicGetRecommendation,\n} from './ecom-recommendations-v1-recommendation-recommendations.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listAvailableAlgorithms: MaybeContext<\n BuildRESTFunction<typeof publicListAvailableAlgorithms> &\n typeof publicListAvailableAlgorithms\n> = /*#__PURE__*/ createRESTModule(publicListAvailableAlgorithms);\nexport const getRecommendation: MaybeContext<\n BuildRESTFunction<typeof publicGetRecommendation> &\n typeof publicGetRecommendation\n> = /*#__PURE__*/ createRESTModule(publicGetRecommendation);\n\nexport { AlgorithmType } from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\nexport {\n Recommendation,\n CatalogReference,\n Algorithm,\n ListAvailableAlgorithmsRequest,\n ListAvailableAlgorithmsResponse,\n AlgorithmInfo,\n AlgorithmConfig,\n GetRecommendationRequest,\n GetRecommendationResponse,\n ItemAppIdNotSupportedByProvider,\n RecommendationAlgorithmNotSupported,\n GetRecommendationOptions,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\nexport {\n AlgorithmTypeWithLiterals,\n GetRecommendationApplicationErrors,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,4DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,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,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAgBd,SAAS,wBACd,SAC4B;AAC5B,WAAS,0BAA0B,EAAE,KAAK,GAAQ;AAChD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAA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AAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAoCA,eAAsBC,mBACpB,YACA,SAiBA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,OAAO,SAAS;AAAA,IAChB,yBAAyB,SAAS;AAAA,EACpC,CAAC;AAED,QAAM,UAC6C,kBAAkB,OAAO;AAE5E,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,yBAAyB;AAAA,QAC3B;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,cAAc,SAAS;AAAA,IAC1B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvWO,SAASC,yBACd,YACkC;AAClC,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;AA+BO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,YACA,YAMAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACjEA,SAAS,wBAAwB;AAG1B,IAAMC,2BAGK,iCAAiBA,wBAA6B;AACzD,IAAMC,qBAGK,iCAAiBA,kBAAuB;","names":["AlgorithmType","listAvailableAlgorithms","getRecommendation","listAvailableAlgorithms","getRecommendation","listAvailableAlgorithms","getRecommendation"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ecom-recommendations-v1-recommendation-recommendations.universal.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.http.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.public.ts","../../../src/ecom-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 ambassadorWixEcomRecommendationsV1Recommendation from './ecom-recommendations-v1-recommendation-recommendations.http.js';\n\nexport interface Recommendation {\n /**\n * Recommended items.\n * @maxSize 100\n */\n items?: CatalogReference[];\n /** The algorithm used to provide the recommendation. */\n algorithm?: Algorithm;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in `key:value` pairs.\n *\n * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n *\n * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface Algorithm {\n /**\n * ID of the algorithm, as defined by the app that provides it.\n * @format GUID\n */\n _id?: string;\n /**\n * ID of the app providing the algorithm. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n}\n\nexport interface ListAvailableAlgorithmsRequest {}\n\nexport interface ListAvailableAlgorithmsResponse {\n /**\n * List of algorithms available for use on a site.\n * @maxSize 500\n */\n availableAlgorithms?: AlgorithmInfo[];\n}\n\nexport interface AlgorithmInfo {\n /** Algorithm configuration. */\n config?: AlgorithmConfig;\n /**\n * ID of the app that provides the algorithm. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n /**\n * IDs of apps with catalogs that this algorithm supports. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minSize 1\n * @maxSize 100\n * @minLength 1\n * @maxLength 36\n */\n catalogAppIds?: string[];\n}\n\nexport interface AlgorithmConfig {\n /**\n * Algorithm name. This value is not translatable.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /**\n * Algorithm description. This describes how the algorithm works and if it has any limitations regarding site content, number of items in the catalog, site traffic, and so on. This value is not translatable.\n * @minLength 1\n * @maxLength 500\n */\n description?: string;\n /**\n * A supplemental `description`. It can be used to help break up and organize information. You can, for example, display this information as a tooltip or as an additional section that is collapsed by default.\n * @minLength 1\n * @maxLength 300\n */\n additionalInfo?: string | null;\n /**\n * Algorithms may have the following types:\n * * `RELATED_ITEMS` - This type of algorithm provides recommendations based on 1 or more other provided items. For example, when an item is added to a cart, the algorithm can suggest other items frequently bought together with that item.\n * * `GLOBAL` - This type of algorithm provides general recommendations based on site or project statistics. For example, bestsellers or new arrivals.\n */\n algorithmType?: AlgorithmTypeWithLiterals;\n /**\n * Algorithm ID. This must be unique for a specific app but does not have to be unique across all apps on the site or in the project.\n * @format GUID\n */\n algorithmId?: string;\n}\n\nexport enum AlgorithmType {\n UNSPECIFIED = 'UNSPECIFIED',\n RELATED_ITEMS = 'RELATED_ITEMS',\n GLOBAL = 'GLOBAL',\n}\n\n/** @enumType */\nexport type AlgorithmTypeWithLiterals =\n | AlgorithmType\n | 'UNSPECIFIED'\n | 'RELATED_ITEMS'\n | 'GLOBAL';\n\nexport interface GetRecommendationRequest {\n /**\n * Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.\n * @minSize 1\n * @maxSize 10\n */\n algorithms: Algorithm[];\n /**\n * Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n\nexport interface GetRecommendationResponse {\n /** The recommended items and the algorithm that provided them. Empty if no algorithm met the `minimumRecommendedItems` threshold. */\n recommendation?: Recommendation;\n}\n\nexport interface ItemAppIdNotSupportedByProvider {\n /**\n * Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the app dashboard.\n * @minSize 1\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms that don't support the requested items.\n * @minSize 1\n * @maxSize 10\n */\n algorithms?: Algorithm[];\n}\n\nexport interface RecommendationAlgorithmNotSupported {\n /**\n * Algorithms not supported by the provider.\n * @minSize 1\n * @maxSize 10\n */\n unsupportedAlgorithms?: Algorithm[];\n}\n\n/** @docsIgnore */\nexport type GetRecommendationApplicationErrors =\n | {\n code?: 'ITEM_APP_ID_NOT_SUPPORTED';\n description?: string;\n data?: ItemAppIdNotSupportedByProvider;\n }\n | {\n code?: 'ALGORITHM_NOT_SUPPORTED';\n description?: string;\n data?: RecommendationAlgorithmNotSupported;\n }\n | {\n code?: 'RECOMMENDATIONS_PROVIDER_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n * @public\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms\n */\nexport async function listAvailableAlgorithms(): Promise<\n NonNullablePaths<\n ListAvailableAlgorithmsResponse,\n | `availableAlgorithms`\n | `availableAlgorithms.${number}.config.name`\n | `availableAlgorithms.${number}.config.description`\n | `availableAlgorithms.${number}.config.algorithmType`\n | `availableAlgorithms.${number}.config.algorithmId`\n | `availableAlgorithms.${number}.appId`,\n 5\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.listAvailableAlgorithms(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n * @param algorithms - Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.\n * @public\n * @requiredField algorithms\n * @requiredField algorithms._id\n * @requiredField algorithms.appId\n * @requiredField options.items.appId\n * @requiredField options.items.catalogItemId\n * @param options - Get recommendation options.\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation\n */\nexport async function getRecommendation(\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n): Promise<\n NonNullablePaths<\n GetRecommendationResponse,\n | `recommendation.items`\n | `recommendation.items.${number}.catalogItemId`\n | `recommendation.items.${number}.appId`\n | `recommendation.algorithm._id`\n | `recommendation.algorithm.appId`,\n 5\n > & {\n __applicationErrorsType?: GetRecommendationApplicationErrors;\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 algorithms: algorithms,\n items: options?.items,\n minimumRecommendedItems: options?.minimumRecommendedItems,\n });\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.getRecommendation(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n algorithms: '$[0]',\n items: '$[1].items',\n minimumRecommendedItems: '$[1].minimumRecommendedItems',\n },\n singleArgumentUnchanged: false,\n },\n ['algorithms', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetRecommendationOptions {\n /**\n * Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n {\n srcPath: '/ecom/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n _: [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/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_ecom_recommendations';\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\nexport function listAvailableAlgorithms(\n payload: object\n): RequestOptionsFactory<any> {\n function __listAvailableAlgorithms({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'GET' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/algorithms',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listAvailableAlgorithms;\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n */\nexport function getRecommendation(payload: object): RequestOptionsFactory<any> {\n function __getRecommendation({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/get',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __getRecommendation;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Algorithm,\n GetRecommendationApplicationErrors,\n GetRecommendationOptions,\n GetRecommendationResponse,\n ListAvailableAlgorithmsResponse,\n getRecommendation as universalGetRecommendation,\n listAvailableAlgorithms as universalListAvailableAlgorithms,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listAvailableAlgorithms(\n httpClient: HttpClient\n): ListAvailableAlgorithmsSignature {\n return () =>\n universalListAvailableAlgorithms(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListAvailableAlgorithmsSignature {\n /**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\n (): Promise<\n NonNullablePaths<\n ListAvailableAlgorithmsResponse,\n | `availableAlgorithms`\n | `availableAlgorithms.${number}.config.name`\n | `availableAlgorithms.${number}.config.description`\n | `availableAlgorithms.${number}.config.algorithmType`\n | `availableAlgorithms.${number}.config.algorithmId`\n | `availableAlgorithms.${number}.appId`,\n 5\n >\n >;\n}\n\nexport function getRecommendation(\n httpClient: HttpClient\n): GetRecommendationSignature {\n return (\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n ) =>\n universalGetRecommendation(\n algorithms,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetRecommendationSignature {\n /**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n * @param - Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.\n * @param - Get recommendation options.\n */\n (\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n ): Promise<\n NonNullablePaths<\n GetRecommendationResponse,\n | `recommendation.items`\n | `recommendation.items.${number}.catalogItemId`\n | `recommendation.items.${number}.appId`\n | `recommendation.algorithm._id`\n | `recommendation.algorithm.appId`,\n 5\n > & {\n __applicationErrorsType?: GetRecommendationApplicationErrors;\n }\n >;\n}\n\nexport {\n Algorithm,\n AlgorithmConfig,\n AlgorithmInfo,\n AlgorithmType,\n CatalogReference,\n GetRecommendationOptions,\n GetRecommendationRequest,\n GetRecommendationResponse,\n ItemAppIdNotSupportedByProvider,\n ListAvailableAlgorithmsRequest,\n ListAvailableAlgorithmsResponse,\n Recommendation,\n RecommendationAlgorithmNotSupported,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\n","import {\n listAvailableAlgorithms as publicListAvailableAlgorithms,\n getRecommendation as publicGetRecommendation,\n} from './ecom-recommendations-v1-recommendation-recommendations.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listAvailableAlgorithms: MaybeContext<\n BuildRESTFunction<typeof publicListAvailableAlgorithms> &\n typeof publicListAvailableAlgorithms\n> = /*#__PURE__*/ createRESTModule(publicListAvailableAlgorithms);\nexport const getRecommendation: MaybeContext<\n BuildRESTFunction<typeof publicGetRecommendation> &\n typeof publicGetRecommendation\n> = /*#__PURE__*/ createRESTModule(publicGetRecommendation);\n\nexport { AlgorithmType } from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\nexport {\n Recommendation,\n CatalogReference,\n Algorithm,\n ListAvailableAlgorithmsRequest,\n ListAvailableAlgorithmsResponse,\n AlgorithmInfo,\n AlgorithmConfig,\n GetRecommendationRequest,\n GetRecommendationResponse,\n ItemAppIdNotSupportedByProvider,\n RecommendationAlgorithmNotSupported,\n GetRecommendationOptions,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\nexport {\n AlgorithmTypeWithLiterals,\n GetRecommendationApplicationErrors,\n} from './ecom-recommendations-v1-recommendation-recommendations.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,E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AC3B;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,cAAc,SAAS;AAAA,IAC1B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AE/VO,SAASC,yBACd,YACkC;AAClC,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;AA+BO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,YACA,YAMAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACjEA,SAAS,wBAAwB;AAG1B,IAAMC,2BAGK,iCAAiBA,wBAA6B;AACzD,IAAMC,qBAGK,iCAAiBA,kBAAuB;","names":["AlgorithmType","listAvailableAlgorithms","getRecommendation","listAvailableAlgorithms","getRecommendation","listAvailableAlgorithms","getRecommendation"]}
|
|
@@ -41,14 +41,14 @@ interface CatalogReference {
|
|
|
41
41
|
}
|
|
42
42
|
interface Algorithm {
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* ID of the algorithm, as defined by the app that provides it.
|
|
45
45
|
* @format GUID
|
|
46
46
|
*/
|
|
47
47
|
_id?: string;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* ID of the app providing the algorithm. This can be an app built by Wix or a 3rd-party app.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
51
|
+
* See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).
|
|
52
52
|
* @minLength 1
|
|
53
53
|
* @maxLength 36
|
|
54
54
|
*/
|
|
@@ -58,26 +58,26 @@ interface ListAvailableAlgorithmsRequest {
|
|
|
58
58
|
}
|
|
59
59
|
interface ListAvailableAlgorithmsResponse {
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* List of algorithms available for use on a site.
|
|
62
62
|
* @maxSize 500
|
|
63
63
|
*/
|
|
64
64
|
availableAlgorithms?: AlgorithmInfo[];
|
|
65
65
|
}
|
|
66
66
|
interface AlgorithmInfo {
|
|
67
|
-
/**
|
|
67
|
+
/** Algorithm configuration. */
|
|
68
68
|
config?: AlgorithmConfig;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* ID of the app that provides the algorithm. This can be an app built by Wix or a 3rd-party app.
|
|
71
71
|
*
|
|
72
|
-
*
|
|
72
|
+
* See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).
|
|
73
73
|
* @minLength 1
|
|
74
74
|
* @maxLength 36
|
|
75
75
|
*/
|
|
76
76
|
appId?: string;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* IDs of apps with catalogs that this algorithm supports. This can be an app built by Wix or a 3rd-party app.
|
|
79
79
|
*
|
|
80
|
-
*
|
|
80
|
+
* See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).
|
|
81
81
|
* @minSize 1
|
|
82
82
|
* @maxSize 100
|
|
83
83
|
* @minLength 1
|
|
@@ -125,34 +125,29 @@ declare enum AlgorithmType {
|
|
|
125
125
|
type AlgorithmTypeWithLiterals = AlgorithmType | 'UNSPECIFIED' | 'RELATED_ITEMS' | 'GLOBAL';
|
|
126
126
|
interface GetRecommendationRequest {
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.
|
|
129
129
|
* @maxSize 300
|
|
130
130
|
*/
|
|
131
131
|
items?: CatalogReference[];
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
134
|
-
* See the method description for more information.
|
|
135
|
-
*
|
|
136
|
-
* If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.
|
|
133
|
+
* Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.
|
|
137
134
|
* @minSize 1
|
|
138
135
|
* @maxSize 10
|
|
139
136
|
*/
|
|
140
137
|
algorithms: Algorithm[];
|
|
141
138
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* Max: `100`
|
|
139
|
+
* Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.
|
|
145
140
|
* @max 100
|
|
146
141
|
*/
|
|
147
142
|
minimumRecommendedItems?: number;
|
|
148
143
|
}
|
|
149
144
|
interface GetRecommendationResponse {
|
|
150
|
-
/**
|
|
145
|
+
/** The recommended items and the algorithm that provided them. Empty if no algorithm met the `minimumRecommendedItems` threshold. */
|
|
151
146
|
recommendation?: Recommendation;
|
|
152
147
|
}
|
|
153
148
|
interface ItemAppIdNotSupportedByProvider {
|
|
154
149
|
/**
|
|
155
|
-
* Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the
|
|
150
|
+
* Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the app dashboard.
|
|
156
151
|
* @minSize 1
|
|
157
152
|
* @maxSize 300
|
|
158
153
|
*/
|
|
@@ -224,10 +219,7 @@ declare function listAvailableAlgorithms(): Promise<NonNullablePaths<ListAvailab
|
|
|
224
219
|
* 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.
|
|
225
220
|
* 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.
|
|
226
221
|
* 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.
|
|
227
|
-
* @param algorithms -
|
|
228
|
-
* See the method description for more information.
|
|
229
|
-
*
|
|
230
|
-
* If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.
|
|
222
|
+
* @param algorithms - Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.
|
|
231
223
|
* @public
|
|
232
224
|
* @requiredField algorithms
|
|
233
225
|
* @requiredField algorithms._id
|
|
@@ -244,14 +236,12 @@ declare function getRecommendation(algorithms: NonNullablePaths<Algorithm, `_id`
|
|
|
244
236
|
}>;
|
|
245
237
|
interface GetRecommendationOptions {
|
|
246
238
|
/**
|
|
247
|
-
*
|
|
239
|
+
* Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.
|
|
248
240
|
* @maxSize 300
|
|
249
241
|
*/
|
|
250
242
|
items?: CatalogReference[];
|
|
251
243
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* Max: `100`
|
|
244
|
+
* Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.
|
|
255
245
|
* @max 100
|
|
256
246
|
*/
|
|
257
247
|
minimumRecommendedItems?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ecom-recommendations-v1-recommendation-recommendations.universal.ts","../../../src/ecom-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 ambassadorWixEcomRecommendationsV1Recommendation from './ecom-recommendations-v1-recommendation-recommendations.http.js';\n\nexport interface Recommendation {\n /**\n * Recommended items.\n * @maxSize 100\n */\n items?: CatalogReference[];\n /** The algorithm used to provide the recommendation. */\n algorithm?: Algorithm;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in `key:value` pairs.\n *\n * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n *\n * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface Algorithm {\n /**\n * Algorithm ID defined by the app providing the algorithm.\n * @format GUID\n */\n _id?: string;\n /**\n * App ID of the Wix or 3rd-party app providing the algorithm.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n}\n\nexport interface ListAvailableAlgorithmsRequest {}\n\nexport interface ListAvailableAlgorithmsResponse {\n /**\n * Algorithms available for use on your Wix site or project. See the method description for more information.\n * @maxSize 500\n */\n availableAlgorithms?: AlgorithmInfo[];\n}\n\nexport interface AlgorithmInfo {\n /** How the algorithm is configured. */\n config?: AlgorithmConfig;\n /**\n * The app ID of the application providing the algorithm.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n /**\n * App IDs of catalogs to which the algorithm can be applied.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minSize 1\n * @maxSize 100\n * @minLength 1\n * @maxLength 36\n */\n catalogAppIds?: string[];\n}\n\nexport interface AlgorithmConfig {\n /**\n * Algorithm name. This value is not translatable.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /**\n * Algorithm description. This describes how the algorithm works and if it has any limitations regarding site content, number of items in the catalog, site traffic, and so on. This value is not translatable.\n * @minLength 1\n * @maxLength 500\n */\n description?: string;\n /**\n * A supplemental `description`. It can be used to help break up and organize information. You can, for example, display this information as a tooltip or as an additional section that is collapsed by default.\n * @minLength 1\n * @maxLength 300\n */\n additionalInfo?: string | null;\n /**\n * Algorithms may have the following types:\n * * `RELATED_ITEMS` - This type of algorithm provides recommendations based on 1 or more other provided items. For example, when an item is added to a cart, the algorithm can suggest other items frequently bought together with that item.\n * * `GLOBAL` - This type of algorithm provides general recommendations based on site or project statistics. For example, bestsellers or new arrivals.\n */\n algorithmType?: AlgorithmTypeWithLiterals;\n /**\n * Algorithm ID. This must be unique for a specific app but does not have to be unique across all apps on the site or in the project.\n * @format GUID\n */\n algorithmId?: string;\n}\n\nexport enum AlgorithmType {\n UNSPECIFIED = 'UNSPECIFIED',\n RELATED_ITEMS = 'RELATED_ITEMS',\n GLOBAL = 'GLOBAL',\n}\n\n/** @enumType */\nexport type AlgorithmTypeWithLiterals =\n | AlgorithmType\n | 'UNSPECIFIED'\n | 'RELATED_ITEMS'\n | 'GLOBAL';\n\nexport interface GetRecommendationRequest {\n /**\n * The set of items for which to get recommendations. Required if the `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * A list of algorithms checked in a specific order determined by their `appID` and their position in the `algorithms` array.\n * See the method description for more information.\n *\n * If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.\n * @minSize 1\n * @maxSize 10\n */\n algorithms: Algorithm[];\n /**\n * The minimum number of items that must be recommended by the algorithm for those items to be returned in the response.\n *\n * Max: `100`\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n\nexport interface GetRecommendationResponse {\n /** An object containing a list of items recommended by 1 of the specified algorithms. The recommendation is empty if none of the specified algorithms recommended enough items. */\n recommendation?: Recommendation;\n}\n\nexport interface ItemAppIdNotSupportedByProvider {\n /**\n * Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the Dev Center.\n * @minSize 1\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms that don't support the requested items.\n * @minSize 1\n * @maxSize 10\n */\n algorithms?: Algorithm[];\n}\n\nexport interface RecommendationAlgorithmNotSupported {\n /**\n * Algorithms not supported by the provider.\n * @minSize 1\n * @maxSize 10\n */\n unsupportedAlgorithms?: Algorithm[];\n}\n\n/** @docsIgnore */\nexport type GetRecommendationApplicationErrors =\n | {\n code?: 'ITEM_APP_ID_NOT_SUPPORTED';\n description?: string;\n data?: ItemAppIdNotSupportedByProvider;\n }\n | {\n code?: 'ALGORITHM_NOT_SUPPORTED';\n description?: string;\n data?: RecommendationAlgorithmNotSupported;\n }\n | {\n code?: 'RECOMMENDATIONS_PROVIDER_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n * @public\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms\n */\nexport async function listAvailableAlgorithms(): Promise<\n NonNullablePaths<\n ListAvailableAlgorithmsResponse,\n | `availableAlgorithms`\n | `availableAlgorithms.${number}.config.name`\n | `availableAlgorithms.${number}.config.description`\n | `availableAlgorithms.${number}.config.algorithmType`\n | `availableAlgorithms.${number}.config.algorithmId`\n | `availableAlgorithms.${number}.appId`,\n 5\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.listAvailableAlgorithms(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n * @param algorithms - A list of algorithms checked in a specific order determined by their `appID` and their position in the `algorithms` array.\n * See the method description for more information.\n *\n * If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.\n * @public\n * @requiredField algorithms\n * @requiredField algorithms._id\n * @requiredField algorithms.appId\n * @requiredField options.items.appId\n * @requiredField options.items.catalogItemId\n * @param options - Get recommendation options.\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation\n */\nexport async function getRecommendation(\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n): Promise<\n NonNullablePaths<\n GetRecommendationResponse,\n | `recommendation.items`\n | `recommendation.items.${number}.catalogItemId`\n | `recommendation.items.${number}.appId`\n | `recommendation.algorithm._id`\n | `recommendation.algorithm.appId`,\n 5\n > & {\n __applicationErrorsType?: GetRecommendationApplicationErrors;\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 algorithms: algorithms,\n items: options?.items,\n minimumRecommendedItems: options?.minimumRecommendedItems,\n });\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.getRecommendation(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n algorithms: '$[0]',\n items: '$[1].items',\n minimumRecommendedItems: '$[1].minimumRecommendedItems',\n },\n singleArgumentUnchanged: false,\n },\n ['algorithms', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetRecommendationOptions {\n /**\n * The set of items for which to get recommendations. Required if the `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * The minimum number of items that must be recommended by the algorithm for those items to be returned in the response.\n *\n * Max: `100`\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n {\n srcPath: '/ecom/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n _: [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/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_ecom_recommendations';\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\nexport function listAvailableAlgorithms(\n payload: object\n): RequestOptionsFactory<any> {\n function __listAvailableAlgorithms({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'GET' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/algorithms',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listAvailableAlgorithms;\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n */\nexport function getRecommendation(payload: object): RequestOptionsFactory<any> {\n function __getRecommendation({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/get',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __getRecommendation;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,4DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,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,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CA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AAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAoCA,eAAsBC,mBACpB,YACA,SAiBA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,OAAO,SAAS;AAAA,IAChB,yBAAyB,SAAS;AAAA,EACpC,CAAC;AAED,QAAM,UAC6C,kBAAkB,OAAO;AAE5E,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,yBAAyB;AAAA,QAC3B;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,cAAc,SAAS;AAAA,IAC1B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["AlgorithmType","listAvailableAlgorithms","getRecommendation"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ecom-recommendations-v1-recommendation-recommendations.universal.ts","../../../src/ecom-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 ambassadorWixEcomRecommendationsV1Recommendation from './ecom-recommendations-v1-recommendation-recommendations.http.js';\n\nexport interface Recommendation {\n /**\n * Recommended items.\n * @maxSize 100\n */\n items?: CatalogReference[];\n /** The algorithm used to provide the recommendation. */\n algorithm?: Algorithm;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in `key:value` pairs.\n *\n * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n *\n * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface Algorithm {\n /**\n * ID of the algorithm, as defined by the app that provides it.\n * @format GUID\n */\n _id?: string;\n /**\n * ID of the app providing the algorithm. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n}\n\nexport interface ListAvailableAlgorithmsRequest {}\n\nexport interface ListAvailableAlgorithmsResponse {\n /**\n * List of algorithms available for use on a site.\n * @maxSize 500\n */\n availableAlgorithms?: AlgorithmInfo[];\n}\n\nexport interface AlgorithmInfo {\n /** Algorithm configuration. */\n config?: AlgorithmConfig;\n /**\n * ID of the app that provides the algorithm. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n /**\n * IDs of apps with catalogs that this algorithm supports. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minSize 1\n * @maxSize 100\n * @minLength 1\n * @maxLength 36\n */\n catalogAppIds?: string[];\n}\n\nexport interface AlgorithmConfig {\n /**\n * Algorithm name. This value is not translatable.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /**\n * Algorithm description. This describes how the algorithm works and if it has any limitations regarding site content, number of items in the catalog, site traffic, and so on. This value is not translatable.\n * @minLength 1\n * @maxLength 500\n */\n description?: string;\n /**\n * A supplemental `description`. It can be used to help break up and organize information. You can, for example, display this information as a tooltip or as an additional section that is collapsed by default.\n * @minLength 1\n * @maxLength 300\n */\n additionalInfo?: string | null;\n /**\n * Algorithms may have the following types:\n * * `RELATED_ITEMS` - This type of algorithm provides recommendations based on 1 or more other provided items. For example, when an item is added to a cart, the algorithm can suggest other items frequently bought together with that item.\n * * `GLOBAL` - This type of algorithm provides general recommendations based on site or project statistics. For example, bestsellers or new arrivals.\n */\n algorithmType?: AlgorithmTypeWithLiterals;\n /**\n * Algorithm ID. This must be unique for a specific app but does not have to be unique across all apps on the site or in the project.\n * @format GUID\n */\n algorithmId?: string;\n}\n\nexport enum AlgorithmType {\n UNSPECIFIED = 'UNSPECIFIED',\n RELATED_ITEMS = 'RELATED_ITEMS',\n GLOBAL = 'GLOBAL',\n}\n\n/** @enumType */\nexport type AlgorithmTypeWithLiterals =\n | AlgorithmType\n | 'UNSPECIFIED'\n | 'RELATED_ITEMS'\n | 'GLOBAL';\n\nexport interface GetRecommendationRequest {\n /**\n * Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.\n * @minSize 1\n * @maxSize 10\n */\n algorithms: Algorithm[];\n /**\n * Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n\nexport interface GetRecommendationResponse {\n /** The recommended items and the algorithm that provided them. Empty if no algorithm met the `minimumRecommendedItems` threshold. */\n recommendation?: Recommendation;\n}\n\nexport interface ItemAppIdNotSupportedByProvider {\n /**\n * Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the app dashboard.\n * @minSize 1\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms that don't support the requested items.\n * @minSize 1\n * @maxSize 10\n */\n algorithms?: Algorithm[];\n}\n\nexport interface RecommendationAlgorithmNotSupported {\n /**\n * Algorithms not supported by the provider.\n * @minSize 1\n * @maxSize 10\n */\n unsupportedAlgorithms?: Algorithm[];\n}\n\n/** @docsIgnore */\nexport type GetRecommendationApplicationErrors =\n | {\n code?: 'ITEM_APP_ID_NOT_SUPPORTED';\n description?: string;\n data?: ItemAppIdNotSupportedByProvider;\n }\n | {\n code?: 'ALGORITHM_NOT_SUPPORTED';\n description?: string;\n data?: RecommendationAlgorithmNotSupported;\n }\n | {\n code?: 'RECOMMENDATIONS_PROVIDER_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n * @public\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms\n */\nexport async function listAvailableAlgorithms(): Promise<\n NonNullablePaths<\n ListAvailableAlgorithmsResponse,\n | `availableAlgorithms`\n | `availableAlgorithms.${number}.config.name`\n | `availableAlgorithms.${number}.config.description`\n | `availableAlgorithms.${number}.config.algorithmType`\n | `availableAlgorithms.${number}.config.algorithmId`\n | `availableAlgorithms.${number}.appId`,\n 5\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.listAvailableAlgorithms(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n * @param algorithms - Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.\n * @public\n * @requiredField algorithms\n * @requiredField algorithms._id\n * @requiredField algorithms.appId\n * @requiredField options.items.appId\n * @requiredField options.items.catalogItemId\n * @param options - Get recommendation options.\n * @permissionId RECOMMENDATIONS.READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation\n */\nexport async function getRecommendation(\n algorithms: NonNullablePaths<Algorithm, `_id` | `appId`, 2>[],\n options?: NonNullablePaths<\n GetRecommendationOptions,\n `items.${number}.appId` | `items.${number}.catalogItemId`,\n 4\n >\n): Promise<\n NonNullablePaths<\n GetRecommendationResponse,\n | `recommendation.items`\n | `recommendation.items.${number}.catalogItemId`\n | `recommendation.items.${number}.appId`\n | `recommendation.algorithm._id`\n | `recommendation.algorithm.appId`,\n 5\n > & {\n __applicationErrorsType?: GetRecommendationApplicationErrors;\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 algorithms: algorithms,\n items: options?.items,\n minimumRecommendedItems: options?.minimumRecommendedItems,\n });\n\n const reqOpts =\n ambassadorWixEcomRecommendationsV1Recommendation.getRecommendation(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n algorithms: '$[0]',\n items: '$[1].items',\n minimumRecommendedItems: '$[1].minimumRecommendedItems',\n },\n singleArgumentUnchanged: false,\n },\n ['algorithms', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface GetRecommendationOptions {\n /**\n * Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n {\n srcPath: '/ecom/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n _: [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/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_ecom_recommendations';\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\nexport function listAvailableAlgorithms(\n payload: object\n): RequestOptionsFactory<any> {\n function __listAvailableAlgorithms({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'GET' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/algorithms',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listAvailableAlgorithms;\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n */\nexport function getRecommendation(payload: object): RequestOptionsFactory<any> {\n function __getRecommendation({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/get',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __getRecommendation;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,4DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QAC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|
42
42
|
}
|
|
43
43
|
interface Algorithm {
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* ID of the algorithm, as defined by the app that provides it.
|
|
46
46
|
* @format GUID
|
|
47
47
|
*/
|
|
48
48
|
id?: string;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* ID of the app providing the algorithm. This can be an app built by Wix or a 3rd-party app.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
52
|
+
* See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).
|
|
53
53
|
* @minLength 1
|
|
54
54
|
* @maxLength 36
|
|
55
55
|
*/
|
|
@@ -59,26 +59,26 @@ interface ListAvailableAlgorithmsRequest {
|
|
|
59
59
|
}
|
|
60
60
|
interface ListAvailableAlgorithmsResponse {
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* List of algorithms available for use on a site.
|
|
63
63
|
* @maxSize 500
|
|
64
64
|
*/
|
|
65
65
|
availableAlgorithms?: AlgorithmInfo[];
|
|
66
66
|
}
|
|
67
67
|
interface AlgorithmInfo {
|
|
68
|
-
/**
|
|
68
|
+
/** Algorithm configuration. */
|
|
69
69
|
config?: AlgorithmConfig;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* ID of the app that provides the algorithm. This can be an app built by Wix or a 3rd-party app.
|
|
72
72
|
*
|
|
73
|
-
*
|
|
73
|
+
* See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).
|
|
74
74
|
* @minLength 1
|
|
75
75
|
* @maxLength 36
|
|
76
76
|
*/
|
|
77
77
|
appId?: string;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* IDs of apps with catalogs that this algorithm supports. This can be an app built by Wix or a 3rd-party app.
|
|
80
80
|
*
|
|
81
|
-
*
|
|
81
|
+
* See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).
|
|
82
82
|
* @minSize 1
|
|
83
83
|
* @maxSize 100
|
|
84
84
|
* @minLength 1
|
|
@@ -126,34 +126,29 @@ declare enum AlgorithmType {
|
|
|
126
126
|
type AlgorithmTypeWithLiterals = AlgorithmType | 'UNSPECIFIED' | 'RELATED_ITEMS' | 'GLOBAL';
|
|
127
127
|
interface GetRecommendationRequest {
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
129
|
+
* Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.
|
|
130
130
|
* @maxSize 300
|
|
131
131
|
*/
|
|
132
132
|
items?: CatalogReference[];
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
135
|
-
* See the method description for more information.
|
|
136
|
-
*
|
|
137
|
-
* If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.
|
|
134
|
+
* Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.
|
|
138
135
|
* @minSize 1
|
|
139
136
|
* @maxSize 10
|
|
140
137
|
*/
|
|
141
138
|
algorithms: Algorithm[];
|
|
142
139
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* Max: `100`
|
|
140
|
+
* Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.
|
|
146
141
|
* @max 100
|
|
147
142
|
*/
|
|
148
143
|
minimumRecommendedItems?: number;
|
|
149
144
|
}
|
|
150
145
|
interface GetRecommendationResponse {
|
|
151
|
-
/**
|
|
146
|
+
/** The recommended items and the algorithm that provided them. Empty if no algorithm met the `minimumRecommendedItems` threshold. */
|
|
152
147
|
recommendation?: Recommendation;
|
|
153
148
|
}
|
|
154
149
|
interface ItemAppIdNotSupportedByProvider {
|
|
155
150
|
/**
|
|
156
|
-
* Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the
|
|
151
|
+
* Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the app dashboard.
|
|
157
152
|
* @minSize 1
|
|
158
153
|
* @maxSize 300
|
|
159
154
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ecom-recommendations-v1-recommendation-recommendations.http.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.types.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.meta.ts"],"sourcesContent":["import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n {\n srcPath: '/ecom/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n _: [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/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_ecom_recommendations';\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\nexport function listAvailableAlgorithms(\n payload: object\n): RequestOptionsFactory<any> {\n function __listAvailableAlgorithms({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'GET' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/algorithms',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listAvailableAlgorithms;\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n */\nexport function getRecommendation(payload: object): RequestOptionsFactory<any> {\n function __getRecommendation({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/get',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __getRecommendation;\n}\n","export interface Recommendation {\n /**\n * Recommended items.\n * @maxSize 100\n */\n items?: CatalogReference[];\n /** The algorithm used to provide the recommendation. */\n algorithm?: Algorithm;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in `key:value` pairs.\n *\n * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n *\n * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface Algorithm {\n /**\n * Algorithm ID defined by the app providing the algorithm.\n * @format GUID\n */\n id?: string;\n /**\n * App ID of the Wix or 3rd-party app providing the algorithm.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n}\n\nexport interface ListAvailableAlgorithmsRequest {}\n\nexport interface ListAvailableAlgorithmsResponse {\n /**\n * Algorithms available for use on your Wix site or project. See the method description for more information.\n * @maxSize 500\n */\n availableAlgorithms?: AlgorithmInfo[];\n}\n\nexport interface AlgorithmInfo {\n /** How the algorithm is configured. */\n config?: AlgorithmConfig;\n /**\n * The app ID of the application providing the algorithm.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n /**\n * App IDs of catalogs to which the algorithm can be applied.\n *\n * Wix app IDs are <a href=\"https://dev.wix.com/api/rest/getting-started/wix-business-solutions#getting-started_wix-business-solutions_about-wix-business-solutions\" target=\"_blank\">listed here</a>.\n * @minSize 1\n * @maxSize 100\n * @minLength 1\n * @maxLength 36\n */\n catalogAppIds?: string[];\n}\n\nexport interface AlgorithmConfig {\n /**\n * Algorithm name. This value is not translatable.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /**\n * Algorithm description. This describes how the algorithm works and if it has any limitations regarding site content, number of items in the catalog, site traffic, and so on. This value is not translatable.\n * @minLength 1\n * @maxLength 500\n */\n description?: string;\n /**\n * A supplemental `description`. It can be used to help break up and organize information. You can, for example, display this information as a tooltip or as an additional section that is collapsed by default.\n * @minLength 1\n * @maxLength 300\n */\n additionalInfo?: string | null;\n /**\n * Algorithms may have the following types:\n * * `RELATED_ITEMS` - This type of algorithm provides recommendations based on 1 or more other provided items. For example, when an item is added to a cart, the algorithm can suggest other items frequently bought together with that item.\n * * `GLOBAL` - This type of algorithm provides general recommendations based on site or project statistics. For example, bestsellers or new arrivals.\n */\n algorithmType?: AlgorithmTypeWithLiterals;\n /**\n * Algorithm ID. This must be unique for a specific app but does not have to be unique across all apps on the site or in the project.\n * @format GUID\n */\n algorithmId?: string;\n}\n\nexport enum AlgorithmType {\n UNSPECIFIED = 'UNSPECIFIED',\n RELATED_ITEMS = 'RELATED_ITEMS',\n GLOBAL = 'GLOBAL',\n}\n\n/** @enumType */\nexport type AlgorithmTypeWithLiterals =\n | AlgorithmType\n | 'UNSPECIFIED'\n | 'RELATED_ITEMS'\n | 'GLOBAL';\n\nexport interface GetRecommendationRequest {\n /**\n * The set of items for which to get recommendations. Required if the `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * A list of algorithms checked in a specific order determined by their `appID` and their position in the `algorithms` array.\n * See the method description for more information.\n *\n * If no algorithm is able to return at least `minimumRecommendedItems` items, an empty array is returned.\n * @minSize 1\n * @maxSize 10\n */\n algorithms: Algorithm[];\n /**\n * The minimum number of items that must be recommended by the algorithm for those items to be returned in the response.\n *\n * Max: `100`\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n\nexport interface GetRecommendationResponse {\n /** An object containing a list of items recommended by 1 of the specified algorithms. The recommendation is empty if none of the specified algorithms recommended enough items. */\n recommendation?: Recommendation;\n}\n\nexport interface ItemAppIdNotSupportedByProvider {\n /**\n * Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the Dev Center.\n * @minSize 1\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms that don't support the requested items.\n * @minSize 1\n * @maxSize 10\n */\n algorithms?: Algorithm[];\n}\n\nexport interface RecommendationAlgorithmNotSupported {\n /**\n * Algorithms not supported by the provider.\n * @minSize 1\n * @maxSize 10\n */\n unsupportedAlgorithms?: Algorithm[];\n}\n\n/** @docsIgnore */\nexport type GetRecommendationApplicationErrors =\n | {\n code?: 'ITEM_APP_ID_NOT_SUPPORTED';\n description?: string;\n data?: ItemAppIdNotSupportedByProvider;\n }\n | {\n code?: 'ALGORITHM_NOT_SUPPORTED';\n description?: string;\n data?: RecommendationAlgorithmNotSupported;\n }\n | {\n code?: 'RECOMMENDATIONS_PROVIDER_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n };\n","import * as ambassadorWixEcomRecommendationsV1Recommendation from './ecom-recommendations-v1-recommendation-recommendations.http.js';\nimport * as ambassadorWixEcomRecommendationsV1RecommendationTypes from './ecom-recommendations-v1-recommendation-recommendations.types.js';\nimport * as ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes from './ecom-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 listAvailableAlgorithms(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.ListAvailableAlgorithmsRequest,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.ListAvailableAlgorithmsRequest,\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.ListAvailableAlgorithmsResponse,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.ListAvailableAlgorithmsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixEcomRecommendationsV1Recommendation.listAvailableAlgorithms(\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: 'GET',\n path: '/v1/recommendations/algorithms',\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 function getRecommendation(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.GetRecommendationRequest,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.GetRecommendationRequest,\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.GetRecommendationResponse,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.GetRecommendationResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixEcomRecommendationsV1Recommendation.getRecommendation(payload);\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 CatalogReference as CatalogReferenceOriginal,\n Algorithm as AlgorithmOriginal,\n ListAvailableAlgorithmsRequest as ListAvailableAlgorithmsRequestOriginal,\n ListAvailableAlgorithmsResponse as ListAvailableAlgorithmsResponseOriginal,\n AlgorithmInfo as AlgorithmInfoOriginal,\n AlgorithmConfig as AlgorithmConfigOriginal,\n AlgorithmType as AlgorithmTypeOriginal,\n AlgorithmTypeWithLiterals as AlgorithmTypeWithLiteralsOriginal,\n GetRecommendationRequest as GetRecommendationRequestOriginal,\n GetRecommendationResponse as GetRecommendationResponseOriginal,\n ItemAppIdNotSupportedByProvider as ItemAppIdNotSupportedByProviderOriginal,\n RecommendationAlgorithmNotSupported as RecommendationAlgorithmNotSupportedOriginal,\n GetRecommendationApplicationErrors as GetRecommendationApplicationErrorsOriginal,\n} from './ecom-recommendations-v1-recommendation-recommendations.types.js';\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,4DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AA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A;;;ACpGL,SAASC,2BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC6C;AAAA,IAC/C;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;AAEO,SAASC,qBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC6C,kBAAkB,OAAO;AAE5E,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":["AlgorithmType","listAvailableAlgorithms","getRecommendation"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ecom-recommendations-v1-recommendation-recommendations.http.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.types.ts","../../../src/ecom-recommendations-v1-recommendation-recommendations.meta.ts"],"sourcesContent":["import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomRecommendationsV1RecommendationsServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n {\n srcPath: '/ecom/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n _: [\n {\n srcPath: '/v1/recommendations',\n destPath: '/v1/recommendations',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/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_ecom_recommendations';\n\n/**\n * Returns a list of recommendation algorithms that can be used on your Wix site or project. These algorithms can be used with [`getRecommendation()`](#getRecommendation) to provide item recommendations to the customer.\n *\n * Algorithms are run by the apps that provide them, and can only be used on catalogs they support. Apps may provide algorithms for use with their own catalogs and/or catalogs from other apps.\n *\n * The app which provides an algorithm is referenced by that algorithm’s `appId`. The apps whose catalogs are supported by an algorithm are referenced by the IDs in that algorithm’s `catalogAppIds` array.\n *\n *\n * For an algorithm to be considered “Available” and returned in this method’s response, the algorithm must meet the following conditions:\n * 1. The algorithm’s `appId` must match the ID of an installed Wix app.\n * 2. At least 1 of the IDs in `catalogAppIds` must match the ID of an installed Wix app.\n *\n * Wix app IDs are [listed here](https://dev.wix.com/docs/api-reference/articles/get-started/apps-created-by-wix).\n */\nexport function listAvailableAlgorithms(\n payload: object\n): RequestOptionsFactory<any> {\n function __listAvailableAlgorithms({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'GET' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.ListAvailableAlgorithms',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/algorithms',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listAvailableAlgorithms;\n}\n\n/**\n * Returns a recommendation object containing a list of items to recommend to the customer.\n *\n * `getRecommendation()` determines which items to recommend based on the given recommendation algorithms.\n *\n * `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them.\n *\n * Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps.\n * For example, Wix Stores provides algorithms that can only be used on its own catalogs.\n * To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed.\n * For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms).\n *\n * `getRecommendation()` operates as follows:\n * 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs.\n * 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app.\n * 3. The app runs the algorithms.\n * 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps.\n * 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process.\n * 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array.\n */\nexport function getRecommendation(payload: object): RequestOptionsFactory<any> {\n function __getRecommendation({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.recommendations.v1.recommendation',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.recommendations.v1.RecommendationsService.GetRecommendation',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixEcomRecommendationsV1RecommendationsServiceUrl({\n protoPath: '/v1/recommendations/get',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __getRecommendation;\n}\n","export interface Recommendation {\n /**\n * Recommended items.\n * @maxSize 100\n */\n items?: CatalogReference[];\n /** The algorithm used to provide the recommendation. */\n algorithm?: Algorithm;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n /**\n * ID of the item within the catalog it belongs to.\n * @minLength 1\n * @maxLength 36\n */\n catalogItemId?: string;\n /**\n * ID of the app providing the catalog.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @minLength 1\n */\n appId?: string;\n /**\n * Additional item details in `key:value` pairs.\n *\n * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n *\n * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n */\n options?: Record<string, any> | null;\n}\n\nexport interface Algorithm {\n /**\n * ID of the algorithm, as defined by the app that provides it.\n * @format GUID\n */\n id?: string;\n /**\n * ID of the app providing the algorithm. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n}\n\nexport interface ListAvailableAlgorithmsRequest {}\n\nexport interface ListAvailableAlgorithmsResponse {\n /**\n * List of algorithms available for use on a site.\n * @maxSize 500\n */\n availableAlgorithms?: AlgorithmInfo[];\n}\n\nexport interface AlgorithmInfo {\n /** Algorithm configuration. */\n config?: AlgorithmConfig;\n /**\n * ID of the app that provides the algorithm. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minLength 1\n * @maxLength 36\n */\n appId?: string;\n /**\n * IDs of apps with catalogs that this algorithm supports. This can be an app built by Wix or a 3rd-party app.\n *\n * See app IDs for [apps built by Wix](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix).\n * @minSize 1\n * @maxSize 100\n * @minLength 1\n * @maxLength 36\n */\n catalogAppIds?: string[];\n}\n\nexport interface AlgorithmConfig {\n /**\n * Algorithm name. This value is not translatable.\n * @minLength 1\n * @maxLength 50\n */\n name?: string;\n /**\n * Algorithm description. This describes how the algorithm works and if it has any limitations regarding site content, number of items in the catalog, site traffic, and so on. This value is not translatable.\n * @minLength 1\n * @maxLength 500\n */\n description?: string;\n /**\n * A supplemental `description`. It can be used to help break up and organize information. You can, for example, display this information as a tooltip or as an additional section that is collapsed by default.\n * @minLength 1\n * @maxLength 300\n */\n additionalInfo?: string | null;\n /**\n * Algorithms may have the following types:\n * * `RELATED_ITEMS` - This type of algorithm provides recommendations based on 1 or more other provided items. For example, when an item is added to a cart, the algorithm can suggest other items frequently bought together with that item.\n * * `GLOBAL` - This type of algorithm provides general recommendations based on site or project statistics. For example, bestsellers or new arrivals.\n */\n algorithmType?: AlgorithmTypeWithLiterals;\n /**\n * Algorithm ID. This must be unique for a specific app but does not have to be unique across all apps on the site or in the project.\n * @format GUID\n */\n algorithmId?: string;\n}\n\nexport enum AlgorithmType {\n UNSPECIFIED = 'UNSPECIFIED',\n RELATED_ITEMS = 'RELATED_ITEMS',\n GLOBAL = 'GLOBAL',\n}\n\n/** @enumType */\nexport type AlgorithmTypeWithLiterals =\n | AlgorithmType\n | 'UNSPECIFIED'\n | 'RELATED_ITEMS'\n | 'GLOBAL';\n\nexport interface GetRecommendationRequest {\n /**\n * Catalog items to base recommendations on. Required if the algorithm's `algorithmType` is `RELATED_ITEMS`.\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms to specify for generating recommendations, ordered by preference. The method processes algorithms in order and provides recommendations from the first algorithm that meets the `minimumRecommendedItems` threshold.\n * @minSize 1\n * @maxSize 10\n */\n algorithms: Algorithm[];\n /**\n * Minimum number of items an algorithm must provide for its recommendations to be returned in the response. If no algorithm provides enough items, an empty array is returned.\n * @max 100\n */\n minimumRecommendedItems?: number;\n}\n\nexport interface GetRecommendationResponse {\n /** The recommended items and the algorithm that provided them. Empty if no algorithm met the `minimumRecommendedItems` threshold. */\n recommendation?: Recommendation;\n}\n\nexport interface ItemAppIdNotSupportedByProvider {\n /**\n * Items with an App ID not supported by the provider. Supported App IDs can be found in the provider config in the app dashboard.\n * @minSize 1\n * @maxSize 300\n */\n items?: CatalogReference[];\n /**\n * Algorithms that don't support the requested items.\n * @minSize 1\n * @maxSize 10\n */\n algorithms?: Algorithm[];\n}\n\nexport interface RecommendationAlgorithmNotSupported {\n /**\n * Algorithms not supported by the provider.\n * @minSize 1\n * @maxSize 10\n */\n unsupportedAlgorithms?: Algorithm[];\n}\n\n/** @docsIgnore */\nexport type GetRecommendationApplicationErrors =\n | {\n code?: 'ITEM_APP_ID_NOT_SUPPORTED';\n description?: string;\n data?: ItemAppIdNotSupportedByProvider;\n }\n | {\n code?: 'ALGORITHM_NOT_SUPPORTED';\n description?: string;\n data?: RecommendationAlgorithmNotSupported;\n }\n | {\n code?: 'RECOMMENDATIONS_PROVIDER_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n };\n","import * as ambassadorWixEcomRecommendationsV1Recommendation from './ecom-recommendations-v1-recommendation-recommendations.http.js';\nimport * as ambassadorWixEcomRecommendationsV1RecommendationTypes from './ecom-recommendations-v1-recommendation-recommendations.types.js';\nimport * as ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes from './ecom-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 listAvailableAlgorithms(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.ListAvailableAlgorithmsRequest,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.ListAvailableAlgorithmsRequest,\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.ListAvailableAlgorithmsResponse,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.ListAvailableAlgorithmsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixEcomRecommendationsV1Recommendation.listAvailableAlgorithms(\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: 'GET',\n path: '/v1/recommendations/algorithms',\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 function getRecommendation(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.GetRecommendationRequest,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.GetRecommendationRequest,\n ambassadorWixEcomRecommendationsV1RecommendationUniversalTypes.GetRecommendationResponse,\n ambassadorWixEcomRecommendationsV1RecommendationTypes.GetRecommendationResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixEcomRecommendationsV1Recommendation.getRecommendation(payload);\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 CatalogReference as CatalogReferenceOriginal,\n Algorithm as AlgorithmOriginal,\n ListAvailableAlgorithmsRequest as ListAvailableAlgorithmsRequestOriginal,\n ListAvailableAlgorithmsResponse as ListAvailableAlgorithmsResponseOriginal,\n AlgorithmInfo as AlgorithmInfoOriginal,\n AlgorithmConfig as AlgorithmConfigOriginal,\n AlgorithmType as AlgorithmTypeOriginal,\n AlgorithmTypeWithLiterals as AlgorithmTypeWithLiteralsOriginal,\n GetRecommendationRequest as GetRecommendationRequestOriginal,\n GetRecommendationResponse as GetRecommendationResponseOriginal,\n ItemAppIdNotSupportedByProvider as ItemAppIdNotSupportedByProviderOriginal,\n RecommendationAlgorithmNotSupported as RecommendationAlgorithmNotSupportedOriginal,\n GetRecommendationApplicationErrors as GetRecommendationApplicationErrorsOriginal,\n} from './ecom-recommendations-v1-recommendation-recommendations.types.js';\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,4DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,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,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAgBd,SAAS,wBACd,SAC4B;AAC5B,WAAS,0BAA0B,EAAE,KAAK,GAAQ;AAChD,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,4DAA4D;AAAA,QAC/D,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;A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