@algolia/recommend
Advanced tools
Comparing version 4.23.1 to 4.23.2
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var cacheCommon = require('@algolia/cache-common'); | ||
@@ -193,12 +191,12 @@ var cacheInMemory = require('@algolia/cache-in-memory'); | ||
} | ||
// eslint-disable-next-line functional/immutable-data | ||
/* eslint-disable functional/immutable-data */ | ||
recommend.version = clientCommon.version; | ||
recommend.getFrequentlyBoughtTogether = getFrequentlyBoughtTogether; | ||
recommend.getRecommendations = getRecommendations; | ||
recommend.getRelatedProducts = getRelatedProducts; | ||
recommend.getTrendingFacets = getTrendingFacets; | ||
recommend.getTrendingItems = getTrendingItems; | ||
recommend.getLookingSimilar = getLookingSimilar; | ||
recommend.getRecommendedForYou = getRecommendedForYou; | ||
exports.default = recommend; | ||
exports.getFrequentlyBoughtTogether = getFrequentlyBoughtTogether; | ||
exports.getLookingSimilar = getLookingSimilar; | ||
exports.getRecommendations = getRecommendations; | ||
exports.getRecommendedForYou = getRecommendedForYou; | ||
exports.getRelatedProducts = getRelatedProducts; | ||
exports.getTrendingFacets = getTrendingFacets; | ||
exports.getTrendingItems = getTrendingItems; | ||
module.exports = recommend; |
@@ -31,30 +31,2 @@ import { AuthModeType } from '@algolia/client-common'; | ||
declare type GetFrequentlyBoughtTogether = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getFrequentlyBoughtTogether']; | ||
export declare const getFrequentlyBoughtTogether: GetFrequentlyBoughtTogether; | ||
declare type GetLookingSimilar = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getLookingSimilar']; | ||
export declare const getLookingSimilar: GetLookingSimilar; | ||
declare type GetRecommendations = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getRecommendations']; | ||
export declare const getRecommendations: GetRecommendations; | ||
declare type GetRecommendedForYou = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getRecommendedForYou']; | ||
export declare const getRecommendedForYou: GetRecommendedForYou; | ||
declare type GetRelatedProducts = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getRelatedProducts']; | ||
export declare const getRelatedProducts: GetRelatedProducts; | ||
declare type GetTrendingFacets = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getTrendingFacets']; | ||
export declare const getTrendingFacets: GetTrendingFacets; | ||
declare type GetTrendingItems = (base: BaseRecommendClient) => WithRecommendMethods<BaseRecommendClient>['getTrendingItems']; | ||
export declare const getTrendingItems: GetTrendingItems; | ||
export declare type LookingSimilarQuery = Omit<RecommendationsQuery, 'model'>; | ||
@@ -66,2 +38,13 @@ | ||
var version: string; | ||
var getFrequentlyBoughtTogether: (base: BaseRecommendClient) => <TObject>(queries: readonly Pick<RecommendationsQuery, "queryParameters" | "objectID" | "indexName" | "threshold" | "maxRecommendations">[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendQueriesResponse<TObject>>>; | ||
var getRecommendations: (base: BaseRecommendClient) => <TObject>(queries: readonly (RecommendationsQuery | (TrendingItemsQuery & { | ||
readonly model: TrendingModel; | ||
}) | (TrendingFacetsQuery & { | ||
readonly model: TrendingModel; | ||
}) | RecommendedForYouQuery)[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendQueriesResponse<TObject>>>; | ||
var getRelatedProducts: (base: BaseRecommendClient) => <TObject>(queries: readonly Pick<RecommendationsQuery, "queryParameters" | "objectID" | "indexName" | "threshold" | "maxRecommendations" | "fallbackParameters">[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendQueriesResponse<TObject>>>; | ||
var getTrendingFacets: (base: BaseRecommendClient) => <TObject>(queries: readonly TrendingFacetsQuery[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendTrendingFacetsQueriesResponse>>; | ||
var getTrendingItems: (base: BaseRecommendClient) => <TObject>(queries: readonly TrendingItemsQuery[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendQueriesResponse<TObject>>>; | ||
var getLookingSimilar: (base: BaseRecommendClient) => <TObject>(queries: readonly Pick<RecommendationsQuery, "queryParameters" | "objectID" | "indexName" | "threshold" | "maxRecommendations" | "fallbackParameters">[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendQueriesResponse<TObject>>>; | ||
var getRecommendedForYou: (base: BaseRecommendClient) => <TObject>(queries: readonly Pick<RecommendedForYouQuery, "queryParameters" | "indexName" | "threshold" | "maxRecommendations" | "fallbackParameters">[], requestOptions?: (RequestOptions_2 & SearchOptions_2) | undefined) => Readonly<Promise<RecommendQueriesResponse<TObject>>>; | ||
} | ||
@@ -163,2 +146,344 @@ export default recommend; | ||
declare type RequestOptions_2 = { | ||
/** | ||
* If the given request should persist on the cache. Keep in mind, | ||
* that some methods may have this option enabled by default. | ||
*/ | ||
readonly cacheable?: boolean; | ||
/** | ||
* Custom timeout for the request. Note that, in normal situacions | ||
* the given timeout will be applied. But the transporter layer may | ||
* increase this timeout if there is need for it. | ||
*/ | ||
readonly timeout?: number; | ||
/** | ||
* Custom headers for the request. This headers are | ||
* going to be merged the transporter headers. | ||
*/ | ||
readonly headers?: Readonly<Record<string, string>>; | ||
/** | ||
* Custom query parameters for the request. This query parameters are | ||
* going to be merged the transporter query parameters. | ||
*/ | ||
readonly queryParameters?: Record<string, any>; | ||
/** | ||
* Custom data for the request. This data are | ||
* going to be merged the transporter data. | ||
*/ | ||
readonly data?: Record<string, any>; | ||
/** | ||
* Additional request body values. It's only taken in | ||
* consideration in `POST` and `PUT` requests. | ||
*/ | ||
[key: string]: any; | ||
}; | ||
declare type SearchOptions_2 = { | ||
/** | ||
* Create a new query with an empty search query. | ||
*/ | ||
readonly query?: string; | ||
/** | ||
* Allows a search for similar objects, but the query has to be constructed on your end and included alongside an empty query. | ||
* | ||
* The similarQuery should be made from the tags and keywords of the relevant object. | ||
*/ | ||
readonly similarQuery?: string; | ||
/** | ||
* Filter hits by facet value. | ||
*/ | ||
readonly facetFilters?: string | readonly string[] | ReadonlyArray<readonly string[] | string>; | ||
/** | ||
* Create filters for ranking purposes, where records that match the filter are ranked highest. | ||
*/ | ||
readonly optionalFilters?: string | readonly string[] | ReadonlyArray<readonly string[] | string>; | ||
/** | ||
* Filter on numeric attributes. | ||
*/ | ||
readonly numericFilters?: string | readonly string[] | ReadonlyArray<readonly string[] | string>; | ||
/** | ||
* Filter hits by tags. tagFilters is a different way of filtering, which relies on the _tags | ||
* attribute. It uses a simpler syntax than filters. You can use it when you want to do | ||
* simple filtering based on tags. | ||
*/ | ||
readonly tagFilters?: string | readonly string[] | ReadonlyArray<readonly string[] | string>; | ||
/** | ||
* Determines how to calculate the total score for filtering. | ||
*/ | ||
readonly sumOrFiltersScores?: boolean; | ||
/** | ||
* Filter the query with numeric, facet and/or tag filters. | ||
*/ | ||
readonly filters?: string; | ||
/** | ||
* Specify the page to retrieve. | ||
*/ | ||
readonly page?: number; | ||
/** | ||
* Set the number of hits per page. | ||
*/ | ||
readonly hitsPerPage?: number; | ||
/** | ||
* Specify the offset of the first hit to return. | ||
*/ | ||
readonly offset?: number; | ||
/** | ||
* Set the number of hits to retrieve (used only with offset). | ||
*/ | ||
readonly length?: number; | ||
/** | ||
* List of attributes to highlight. | ||
*/ | ||
readonly attributesToHighlight?: readonly string[]; | ||
/** | ||
* List of attributes to snippet, with an optional maximum number of words to snippet. | ||
*/ | ||
readonly attributesToSnippet?: readonly string[]; | ||
/** | ||
* Gives control over which attributes to retrieve and which not to retrieve. | ||
*/ | ||
readonly attributesToRetrieve?: readonly string[]; | ||
/** | ||
* The HTML string to insert before the highlighted parts in all highlight and snippet results. | ||
*/ | ||
readonly highlightPreTag?: string; | ||
/** | ||
* The HTML string to insert after the highlighted parts in all highlight and snippet results | ||
*/ | ||
readonly highlightPostTag?: string; | ||
/** | ||
* String used as an ellipsis indicator when a snippet is truncated. | ||
*/ | ||
readonly snippetEllipsisText?: string; | ||
/** | ||
* Restrict highlighting and snippeting to items that matched the query. | ||
*/ | ||
readonly restrictHighlightAndSnippetArrays?: boolean; | ||
/** | ||
* Facets to retrieve. | ||
*/ | ||
readonly facets?: readonly string[]; | ||
/** | ||
* Maximum number of facet values to return for each facet during a regular search. | ||
*/ | ||
readonly maxValuesPerFacet?: number; | ||
/** | ||
* Force faceting to be applied after de-duplication (via the Distinct setting). | ||
*/ | ||
readonly facetingAfterDistinct?: boolean; | ||
/** | ||
* Minimum number of characters a word in the query string must contain to accept matches with 1 typo | ||
*/ | ||
readonly minWordSizefor1Typo?: number; | ||
/** | ||
* Minimum number of characters a word in the query string must contain to accept matches with 2 typos. | ||
*/ | ||
readonly minWordSizefor2Typos?: number; | ||
/** | ||
* Whether to allow typos on numbers (“numeric tokens”) in the query string. | ||
*/ | ||
readonly allowTyposOnNumericTokens?: boolean; | ||
/** | ||
* List of attributes on which you want to disable typo tolerance. | ||
*/ | ||
readonly disableTypoToleranceOnAttributes?: readonly string[]; | ||
/** | ||
* Controls if and how query words are interpreted as prefixes. | ||
*/ | ||
readonly queryType?: 'prefixLast' | 'prefixAll' | 'prefixNone'; | ||
/** | ||
* Selects a strategy to remove words from the query when it doesn’t match any hits. | ||
*/ | ||
readonly removeWordsIfNoResults?: 'none' | 'lastWords' | 'firstWords' | 'allOptional'; | ||
/** | ||
* Enables the advanced query syntax. | ||
*/ | ||
readonly advancedSyntax?: boolean; | ||
/** | ||
* AdvancedSyntaxFeatures can be exactPhrase or excludeWords | ||
*/ | ||
readonly advancedSyntaxFeatures?: ReadonlyArray<'exactPhrase' | 'excludeWords'>; | ||
/** | ||
* A list of words that should be considered as optional when found in the query. | ||
*/ | ||
readonly optionalWords?: string | readonly string[]; | ||
/** | ||
* List of attributes on which you want to disable the exact ranking criterion. | ||
*/ | ||
readonly disableExactOnAttributes?: readonly string[]; | ||
/** | ||
* Controls how the exact ranking criterion is computed when the query contains only one word. | ||
*/ | ||
readonly exactOnSingleWordQuery?: 'attribute' | 'none' | 'word'; | ||
/** | ||
* List of alternatives that should be considered an exact match by the exact ranking criterion. | ||
*/ | ||
readonly alternativesAsExact?: ReadonlyArray<'ignorePlurals' | 'singleWordSynonym' | 'multiWordsSynonym'>; | ||
/** | ||
* Whether rules should be globally enabled. | ||
*/ | ||
readonly enableRules?: boolean; | ||
/** | ||
* Enables contextual rules. | ||
*/ | ||
readonly ruleContexts?: readonly string[]; | ||
/** | ||
* Enables de-duplication or grouping of results. | ||
*/ | ||
readonly distinct?: boolean | number; | ||
/** | ||
* Whether the current query will be taken into account in the Analytics | ||
*/ | ||
readonly analytics?: boolean; | ||
/** | ||
* List of tags to apply to the query in the analytics. | ||
*/ | ||
readonly analyticsTags?: readonly string[]; | ||
/** | ||
* Whether to take into account an index’s synonyms for a particular search. | ||
*/ | ||
readonly synonyms?: boolean; | ||
/** | ||
* Whether to highlight and snippet the original word that matches the synonym or the synonym itself. | ||
*/ | ||
readonly replaceSynonymsInHighlight?: boolean; | ||
/** | ||
* Precision of the proximity ranking criterion. | ||
*/ | ||
readonly minProximity?: number; | ||
/** | ||
* Choose which fields the response will contain. Applies to search and browse queries. | ||
*/ | ||
readonly responseFields?: readonly string[]; | ||
/** | ||
* Maximum number of facet hits to return during a search for facet values. | ||
*/ | ||
readonly maxFacetHits?: number; | ||
/** | ||
* Whether to include or exclude a query from the processing-time percentile computation. | ||
*/ | ||
readonly percentileComputation?: boolean; | ||
/** | ||
* Enable the Click Analytics feature. | ||
*/ | ||
readonly clickAnalytics?: boolean; | ||
/** | ||
* The `personalizationImpact` parameter sets the percentage of the impact that personalization has on ranking records. The | ||
* value must be between 0 and 100 (inclusive). This parameter will not be taken into account if `enablePersonalization` | ||
* is **false**. | ||
*/ | ||
readonly personalizationImpact?: number; | ||
/** | ||
* Enable personalization for the query | ||
*/ | ||
readonly enablePersonalization?: boolean; | ||
/** | ||
* Restricts a given query to look in only a subset of your searchable attributes. | ||
*/ | ||
readonly restrictSearchableAttributes?: readonly string[]; | ||
/** | ||
* Controls how facet values are sorted. | ||
*/ | ||
readonly sortFacetValuesBy?: 'count' | 'alpha'; | ||
/** | ||
* Controls whether typo tolerance is enabled and how it is applied. | ||
*/ | ||
readonly typoTolerance?: boolean | 'min' | 'strict'; | ||
/** | ||
* Search for entries around a central geolocation, enabling a geo search within a circular area. | ||
*/ | ||
readonly aroundLatLng?: string; | ||
/** | ||
* Search for entries around a given location automatically computed from the requester’s IP address. | ||
*/ | ||
readonly aroundLatLngViaIP?: boolean; | ||
/** | ||
* Define the maximum radius for a geo search (in meters). | ||
*/ | ||
readonly aroundRadius?: number | 'all'; | ||
/** | ||
* Precision of geo search (in meters), to add grouping by geo location to the ranking formula. | ||
*/ | ||
readonly aroundPrecision?: number | ReadonlyArray<{ | ||
readonly from: number; | ||
readonly value: number; | ||
}>; | ||
/** | ||
* Minimum radius (in meters) used for a geo search when aroundRadius is not set. | ||
*/ | ||
readonly minimumAroundRadius?: number; | ||
/** | ||
* Search inside a rectangular area (in geo coordinates). | ||
*/ | ||
readonly insideBoundingBox?: ReadonlyArray<readonly number[]> | string; | ||
/** | ||
* Search inside a polygon (in geo coordinates). | ||
*/ | ||
readonly insidePolygon?: ReadonlyArray<readonly number[]>; | ||
/** | ||
* Treats singular, plurals, and other forms of declensions as matching terms. | ||
*/ | ||
readonly ignorePlurals?: boolean | readonly string[]; | ||
/** | ||
* Removes stop (common) words from the query before executing it. | ||
*/ | ||
readonly removeStopWords?: boolean | readonly string[]; | ||
/** | ||
* List of supported languages with their associated language ISO code. | ||
* | ||
* Apply a set of natural language best practices such as ignorePlurals, | ||
* removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. | ||
*/ | ||
readonly naturalLanguages?: readonly string[]; | ||
/** | ||
* When true, each hit in the response contains an additional _rankingInfo object. | ||
*/ | ||
readonly getRankingInfo?: boolean; | ||
/** | ||
* A user identifier. | ||
* Format: alpha numeric string [a-zA-Z0-9_-] | ||
* Length: between 1 and 64 characters. | ||
*/ | ||
readonly userToken?: string; | ||
/** | ||
* Can be to enable or disable A/B tests at query time. | ||
* Engine's default: true | ||
*/ | ||
readonly enableABTest?: boolean; | ||
/** | ||
* Enable word segmentation (also called decompounding) at query time for | ||
* compatible languages. For example, this turns the Dutch query | ||
* "spaanplaatbehang" into "spaan plaat behang" to retrieve more relevant | ||
* results. | ||
*/ | ||
readonly decompoundQuery?: boolean; | ||
/** | ||
* The relevancy threshold to apply to search in a virtual index [0-100]. A Bigger | ||
* value means fewer, but more relevant results, smaller value means more, but | ||
* less relevant results. | ||
*/ | ||
readonly relevancyStrictness?: number; | ||
/** | ||
* Whether this search should use Dynamic Re-Ranking. | ||
* @link https://www.algolia.com/doc/guides/algolia-ai/re-ranking/ | ||
* | ||
* Note: You need to turn on Dynamic Re-Ranking on your index for it to have an effect on | ||
* your search results. You can do this through the Re-Ranking page on the dashboard. | ||
* This parameter is only used to turn off Dynamic Re-Ranking (with false) at search time. | ||
*/ | ||
readonly enableReRanking?: boolean; | ||
/** | ||
* When Dynamic Re-Ranking is enabled, only records that match these filters will be impacted by Dynamic Re-Ranking. | ||
*/ | ||
readonly reRankingApplyFilter?: string | readonly string[] | ReadonlyArray<readonly string[] | string> | null; | ||
/** | ||
* Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. | ||
*/ | ||
readonly queryLanguages?: readonly string[]; | ||
/** | ||
* Enriches the API’s response with meta-information as to how the query was processed. | ||
*/ | ||
readonly explain?: readonly string[]; | ||
}; | ||
export declare type TrendingFacetHit = { | ||
@@ -165,0 +490,0 @@ readonly _score: number; |
@@ -209,3 +209,3 @@ function createBrowserLocalStorageCache(options) { | ||
const version = '4.23.1'; | ||
const version = '4.23.2'; | ||
@@ -949,6 +949,12 @@ const AuthMode = { | ||
} | ||
// eslint-disable-next-line functional/immutable-data | ||
/* eslint-disable functional/immutable-data */ | ||
recommend.version = version; | ||
recommend.getFrequentlyBoughtTogether = getFrequentlyBoughtTogether; | ||
recommend.getRecommendations = getRecommendations; | ||
recommend.getRelatedProducts = getRelatedProducts; | ||
recommend.getTrendingFacets = getTrendingFacets; | ||
recommend.getTrendingItems = getTrendingItems; | ||
recommend.getLookingSimilar = getLookingSimilar; | ||
recommend.getRecommendedForYou = getRecommendedForYou; | ||
export default recommend; | ||
export { getFrequentlyBoughtTogether, getLookingSimilar, getRecommendations, getRecommendedForYou, getRelatedProducts, getTrendingFacets, getTrendingItems }; |
@@ -1,2 +0,2 @@ | ||
/*! recommend.umd.js | 4.23.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["@algolia/recommend"]={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")},i=function(e){n().setItem(r,JSON.stringify(e))},u=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=a(),n=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==o(e,2)[1].timestamp})));if(i(n),t){var u=Object.fromEntries(Object.entries(n).filter((function(e){var r=o(e,2)[1],n=(new Date).getTime();return!(r.timestamp+t<n)})));i(u)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){u();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=o(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(o)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function u(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},n=t();return n.then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,o).catch((function(){return u({caches:t}).get(e,n,o)}))},set:function(e,n){return r.set(e,n).catch((function(){return u({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return u({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return u({caches:t}).clear()}))}}}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var i=n(),u=o&&o.miss||function(){return Promise.resolve()};return i.then((function(e){return u(e)})).then((function(){return i}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function c(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var l={WithinQueryParameters:0,WithinHeaders:1},f=1,d=2,m=3;function h(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var g={Read:1,Write:2,Any:3},p=1,v=2,y=3;function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return n(n({},e),{},{status:t,lastUpdate:Date.now()})}function O(e){return"string"==typeof e?{protocol:"https",url:e,accept:g.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||g.Any}}var P="GET",q="POST";function j(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(b(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===y&&Date.now()-e.lastUpdate<=12e4}(e)})),o=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:o.length>0?o.map((function(e){return O(e)})):t}}))}function S(e,t,r,o){var i=[],u=function(e,t){if(e.method===P||void 0===e.data&&void 0===t.data)return;var r=Array.isArray(e.data)?e.data:n(n({},e.data),t.data);return JSON.stringify(r)}(r,o),s=function(e,t){var r=n(n({},e.headers),t.headers),o={};return Object.keys(r).forEach((function(e){var t=r[e];o[e.toLowerCase()]=t})),o}(e,o),c=r.method,l=r.method!==P?{}:n(n({},r.data),o.data),f=n(n(n({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),o.queryParameters),d=0,m=function t(n,a){var l=n.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:A(i)};var m={data:u,headers:s,method:c,url:w(l,r.path,f),connectTimeout:a(d,e.timeouts.connect),responseTimeout:a(d,o.timeout)},h=function(e){var t={request:m,response:e,host:l,triesLeft:n.length};return i.push(t),t},g={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(r){var o=h(r);return r.isTimedOut&&d++,Promise.all([e.logger.info("Retryable failure",C(o)),e.hostsCache.set(l,b(l,r.isTimedOut?y:v))]).then((function(){return t(n,a)}))},onFail:function(e){throw h(e),function(e,t){var r=e.content,n=e.status,o=r;try{o=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(o,n,t)}(e,A(i))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,g)}))};return j(e.hostsCache,t).then((function(e){return m(a(e.statelessHosts).reverse(),e.getTimeout)}))}function T(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function w(e,t,r){var n,o=(n=r,Object.keys(n).map((function(e){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[o++])}))}("%s=%s",e,(t=n[e],"[object Object]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t)?JSON.stringify(n[e]):n[e]));var t})).join("&")),a="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return o.length&&(a+="?".concat(o)),a}function A(e){return e.map((function(e){return C(e)}))}function C(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return n(n({},e),{},{request:n(n({},e.request),{},{headers:n(n({},e.request.headers),t)})})}var k=function(e){var t=e.appId,r=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===l.WithinHeaders?n:{}},queryParameters:function(){return e===l.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:l.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,i=e.responsesCache,u=e.timeouts,s=e.userAgent,c=e.hosts,l=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:i,timeouts:u,userAgent:s,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return O(e)})),read:function(e,t){var r=h(t,f.timeouts.read),n=function(){return S(f,f.hosts.filter((function(e){return 0!=(e.accept&g.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,n()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=o(e,2);t[0];return t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return S(f,f.hosts.filter((function(e){return 0!=(e.accept&g.Write)})),e,h(t,f.timeouts.write))}};return f}(n(n({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:g.Read},{url:"".concat(t,".algolia.net"),accept:g.Write}].concat(c([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:n(n(n({},r.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:n(n({},r.queryParameters()),e.queryParameters)}));return function(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},x=function(e){return function(t,r){var o=t.map((function(e){return n(n({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:q,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},r)}},N=function(e){return function(t,r){return x(e)(t.map((function(e){return n(n({},e),{},{fallbackParameters:{},model:"bought-together"})})),r)}},R=function(e){return function(t,r){return x(e)(t.map((function(e){return n(n({},e),{},{model:"related-products"})})),r)}},J=function(e){return function(t,r){var o=t.map((function(e){return n(n({},e),{},{model:"trending-facets",threshold:e.threshold||0})}));return e.transporter.read({method:q,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},r)}},E=function(e){return function(t,r){var o=t.map((function(e){return n(n({},e),{},{model:"trending-items",threshold:e.threshold||0})}));return e.transporter.read({method:q,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},r)}},I=function(e){return function(t,r){return x(e)(t.map((function(e){return n(n({},e),{},{model:"looking-similar"})})),r)}},D=function(e){return function(t,r){var o=t.map((function(e){return n(n({},e),{},{model:"recommended-for-you",threshold:e.threshold||0})}));return e.transporter.read({method:q,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},r)}};function W(e,t,r){var o,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,o=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=o(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=o(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=m,{debug:function(e,t){return f>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return d>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:u({caches:[i({key:"".concat("4.23.1","-").concat(e)}),s()]}),userAgent:T("4.23.1").add({segment:"Recommend",version:"4.23.1"}).add({segment:"Browser"}),authMode:l.WithinQueryParameters};return k(n(n(n({},a),r),{},{methods:{getFrequentlyBoughtTogether:N,getRecommendations:x,getRelatedProducts:R,getTrendingFacets:J,getTrendingItems:E,getLookingSimilar:I,getRecommendedForYou:D}}))}W.version="4.23.1",e.default=W,e.getFrequentlyBoughtTogether=N,e.getLookingSimilar=I,e.getRecommendations=x,e.getRecommendedForYou=D,e.getRelatedProducts=R,e.getTrendingFacets=J,e.getTrendingItems=E,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
/*! recommend.umd.js | 4.23.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self)["@algolia/recommend"]=t()}(this,(function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function a(e){var t,r="algoliasearch-client-js-".concat(e.key),o=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(o().getItem(r)||"{}")},i=function(e){o().setItem(r,JSON.stringify(e))},u=function(){var t=e.timeToLive?1e3*e.timeToLive:null,r=a(),o=Object.fromEntries(Object.entries(r).filter((function(e){return void 0!==n(e,2)[1].timestamp})));if(i(o),t){var u=Object.fromEntries(Object.entries(o).filter((function(e){var r=n(e,2)[1],o=(new Date).getTime();return!(r.timestamp+t<o)})));i(u)}};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){u();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=n(e,2),o=t[0],a=t[1];return Promise.all([o,a||r.miss(o)])})).then((function(e){return n(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var n=a();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},o().setItem(r,JSON.stringify(n)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],o().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){o().removeItem(r)}))}}}function i(e){var t=o(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},o=t();return o.then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return n(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,o).catch((function(){return i({caches:t}).get(e,n,o)}))},set:function(e,n){return r.set(e,n).catch((function(){return i({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return i({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return i({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var i=n(),u=o&&o.miss||function(){return Promise.resolve()};return i.then((function(e){return u(e)})).then((function(){return i}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function s(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var c={WithinQueryParameters:0,WithinHeaders:1},l=1,f=2,m=3;function d(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var h={Read:1,Write:2,Any:3},g=1,p=2,v=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function b(e){return"string"==typeof e?{protocol:"https",url:e,accept:h.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||h.Any}}var O="GET",P="POST";function q(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===g||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===v&&Date.now()-e.lastUpdate<=12e4}(e)})),a=[].concat(o(r),o(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:a.length>0?a.map((function(e){return b(e)})):t}}))}function j(e,t,n,a){var i=[],u=function(e,t){if(e.method===O||void 0===e.data&&void 0===t.data)return;var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}(n,a),s=function(e,t){var n=r(r({},e.headers),t.headers),o={};return Object.keys(n).forEach((function(e){var t=n[e];o[e.toLowerCase()]=t})),o}(e,a),c=n.method,l=n.method!==O?{}:r(r({},n.data),a.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),a.queryParameters),m=0,d=function t(r,o){var l=r.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:w(i)};var d={data:u,headers:s,method:c,url:T(l,n.path,f),connectTimeout:o(m,e.timeouts.connect),responseTimeout:o(m,a.timeout)},h=function(e){var t={request:d,response:e,host:l,triesLeft:r.length};return i.push(t),t},g={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var a=h(n);return n.isTimedOut&&m++,Promise.all([e.logger.info("Retryable failure",A(a)),e.hostsCache.set(l,y(l,n.isTimedOut?v:p))]).then((function(){return t(r,o)}))},onFail:function(e){throw h(e),function(e,t){var r=e.content,n=e.status,o=r;try{o=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(o,n,t)}(e,w(i))}};return e.requester.send(d).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,g)}))};return q(e.hostsCache,t).then((function(e){return d(o(e.statelessHosts).reverse(),e.getTimeout)}))}function S(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function T(e,t,r){var n,o=(n=r,Object.keys(n).map((function(e){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[o++])}))}("%s=%s",e,(t=n[e],"[object Object]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t)?JSON.stringify(n[e]):n[e]));var t})).join("&")),a="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return o.length&&(a+="?".concat(o)),a}function w(e){return e.map((function(e){return A(e)}))}function A(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var C=function(e){var t=e.appId,o=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===c.WithinHeaders?n:{}},queryParameters:function(){return e===c.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:c.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,o=e.requester,a=e.requestsCache,i=e.responsesCache,u=e.timeouts,s=e.userAgent,c=e.hosts,l=e.queryParameters,f={hostsCache:t,logger:r,requester:o,requestsCache:a,responsesCache:i,timeouts:u,userAgent:s,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return b(e)})),read:function(e,t){var r=d(t,f.timeouts.read),o=function(){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&h.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return o();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,o()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=n(e,2);t[0];return t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return j(f,f.hosts.filter((function(e){return 0!=(e.accept&h.Write)})),e,d(t,f.timeouts.write))}};return f}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:h.Read},{url:"".concat(t,".algolia.net"),accept:h.Write}].concat(s([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},o.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},o.queryParameters()),e.queryParameters)}));return function(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},k=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},n)}},N=function(e){return function(t,n){return k(e)(t.map((function(e){return r(r({},e),{},{fallbackParameters:{},model:"bought-together"})})),n)}},R=function(e){return function(t,n){return k(e)(t.map((function(e){return r(r({},e),{},{model:"related-products"})})),n)}},x=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{model:"trending-facets",threshold:e.threshold||0})}));return e.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},n)}},J=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{model:"trending-items",threshold:e.threshold||0})}));return e.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},n)}},E=function(e){return function(t,n){return k(e)(t.map((function(e){return r(r({},e),{},{model:"looking-similar"})})),n)}},I=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{model:"recommended-for-you",threshold:e.threshold||0})}));return e.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:o},cacheable:!0},n)}};function D(e,t,n){var o,s={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,o=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=o(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=o(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=m,{debug:function(e,t){return l>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return f>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:i({caches:[a({key:"".concat("4.23.2","-").concat(e)}),u()]}),userAgent:S("4.23.2").add({segment:"Recommend",version:"4.23.2"}).add({segment:"Browser"}),authMode:c.WithinQueryParameters};return C(r(r(r({},s),n),{},{methods:{getFrequentlyBoughtTogether:N,getRecommendations:k,getRelatedProducts:R,getTrendingFacets:x,getTrendingItems:J,getLookingSimilar:E,getRecommendedForYou:I}}))}return D.version="4.23.2",D.getFrequentlyBoughtTogether=N,D.getRecommendations=k,D.getRelatedProducts=R,D.getTrendingFacets=x,D.getTrendingItems=J,D.getLookingSimilar=E,D.getRecommendedForYou=I,D})); |
{ | ||
"name": "@algolia/recommend", | ||
"version": "4.23.1", | ||
"version": "4.23.2", | ||
"private": false, | ||
@@ -24,15 +24,18 @@ "description": "The perfect starting point to integrate Algolia Recommend within your JavaScript project.", | ||
], | ||
"scripts": { | ||
"test:exports": "node --experimental-modules test/module/is-es-module.mjs && node test/module/is-cjs-module.cjs" | ||
}, | ||
"dependencies": { | ||
"@algolia/cache-browser-local-storage": "4.23.1", | ||
"@algolia/cache-common": "4.23.1", | ||
"@algolia/cache-in-memory": "4.23.1", | ||
"@algolia/client-common": "4.23.1", | ||
"@algolia/client-search": "4.23.1", | ||
"@algolia/logger-common": "4.23.1", | ||
"@algolia/logger-console": "4.23.1", | ||
"@algolia/requester-browser-xhr": "4.23.1", | ||
"@algolia/requester-common": "4.23.1", | ||
"@algolia/requester-node-http": "4.23.1", | ||
"@algolia/transporter": "4.23.1" | ||
"@algolia/cache-browser-local-storage": "4.23.2", | ||
"@algolia/cache-common": "4.23.2", | ||
"@algolia/cache-in-memory": "4.23.2", | ||
"@algolia/client-common": "4.23.2", | ||
"@algolia/client-search": "4.23.2", | ||
"@algolia/logger-common": "4.23.2", | ||
"@algolia/logger-console": "4.23.2", | ||
"@algolia/requester-browser-xhr": "4.23.2", | ||
"@algolia/requester-common": "4.23.2", | ||
"@algolia/requester-node-http": "4.23.2", | ||
"@algolia/transporter": "4.23.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85274
1747
+ Added@algolia/cache-browser-local-storage@4.23.2(transitive)
+ Added@algolia/cache-common@4.23.2(transitive)
+ Added@algolia/cache-in-memory@4.23.2(transitive)
+ Added@algolia/client-common@4.23.2(transitive)
+ Added@algolia/client-search@4.23.2(transitive)
+ Added@algolia/logger-common@4.23.2(transitive)
+ Added@algolia/logger-console@4.23.2(transitive)
+ Added@algolia/requester-browser-xhr@4.23.2(transitive)
+ Added@algolia/requester-common@4.23.2(transitive)
+ Added@algolia/requester-node-http@4.23.2(transitive)
+ Added@algolia/transporter@4.23.2(transitive)
- Removed@algolia/cache-browser-local-storage@4.23.1(transitive)
- Removed@algolia/cache-common@4.23.1(transitive)
- Removed@algolia/cache-in-memory@4.23.1(transitive)
- Removed@algolia/client-common@4.23.1(transitive)
- Removed@algolia/client-search@4.23.1(transitive)
- Removed@algolia/logger-common@4.23.1(transitive)
- Removed@algolia/logger-console@4.23.1(transitive)
- Removed@algolia/requester-browser-xhr@4.23.1(transitive)
- Removed@algolia/requester-common@4.23.1(transitive)
- Removed@algolia/requester-node-http@4.23.1(transitive)
- Removed@algolia/transporter@4.23.1(transitive)
Updated@algolia/cache-common@4.23.2
Updated@algolia/transporter@4.23.2