@algolia/recommend-react
Advanced tools
Comparing version 1.0.0-experimental.3 to 1.0.0-experimental.4
import _extends from "@babel/runtime/helpers/extends"; | ||
import { createFrequentlyBoughtTogetherComponent } from '@algolia/recommend-vdom'; | ||
import React, { createElement, Fragment } from 'react'; | ||
import { useRelatedProducts } from './useRelatedProducts'; | ||
import { useFrequentlyBoughtTogether } from './useFrequentlyBoughtTogether'; | ||
var UncontrolledFrequentlyBoughtTogether = createFrequentlyBoughtTogetherComponent({ | ||
@@ -10,4 +10,4 @@ createElement: createElement, | ||
export function FrequentlyBoughtTogether(props) { | ||
var _useRelatedProducts = useRelatedProducts(props), | ||
recommendations = _useRelatedProducts.recommendations; | ||
var _useFrequentlyBoughtT = useFrequentlyBoughtTogether(props), | ||
recommendations = _useFrequentlyBoughtT.recommendations; | ||
@@ -14,0 +14,0 @@ return /*#__PURE__*/React.createElement(UncontrolledFrequentlyBoughtTogether, _extends({}, props, { |
@@ -1,1 +0,1 @@ | ||
export declare const version = "1.0.0-experimental.3"; | ||
export declare const version = "1.0.0-experimental.4"; |
@@ -1,1 +0,1 @@ | ||
export var version = '1.0.0-experimental.3'; | ||
export var version = '1.0.0-experimental.4'; |
@@ -1,3 +0,3 @@ | ||
/*! @algolia/recommend-react 1.0.0-experimental.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/ui-components */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend-react"]={},e.React)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}function i(e){var t=e.createElement;return function(e){return 0===e.recommendations.length?t(e.Fallback,null):t("section",{className:c("auc-Recommend",e.classNames.root)},t(e.Header,{classNames:e.classNames,recommendations:e.recommendations,translations:e.translations}),t(e.View,null))}}function l(e){var t=e.createElement;return function(e){return e.translations.title?t("h3",{className:c("auc-Recommend-title",e.classNames.title)},e.translations.title):null}}function s(e){var t=e.createElement;return function(e){return t("div",{className:c("auc-Recommend-container",e.classNames.container)},t("ol",{className:c("auc-Recommend-list",e.classNames.list)},e.items.map((function(r){return t("li",{key:r.objectID,className:c("auc-Recommend-item",e.classNames.item)},t(e.itemComponent,{item:r}))}))))}}function u(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 m(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 f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var n,o,a=[],c=!0,i=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);c=!0);}catch(e){i=!0,o=e}finally{try{c||null==r.return||r.return()}finally{if(i)throw o}}return a}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var t=e.fallbackFilters,r=e.recommendations,n=e.threshold;if(0===r.length)return t;var o=r.filter((function(e){return e.score>n})).map((function(e){var t=e.objectID,r=e.score;return"objectID:".concat(t,"<score=").concat(100*r,">")}));return[].concat(b(o),b(t))}function y(e){return function(t){switch(t){case"bought-together":return o=(n=e).fallbackFilters,a=n.recommendations,c=n.threshold,0===o.length?{facetFilters:[a.filter((function(e){return e.score>c})).map((function(e){return"objectID:".concat(e.objectID)}))]}:{optionalFilters:h({fallbackFilters:o,recommendations:a,threshold:c})};case"related-products":return{optionalFilters:h({fallbackFilters:(r=e).fallbackFilters,recommendations:r.recommendations,threshold:r.threshold})};default:throw new Error("Unknown model: ".concat(JSON.stringify(t),"."))}var r,n,o,a,c}}function O(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 g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e){var t=function(e){return g(g({fallbackFilters:[],maxRecommendations:0,threshold:0,transformItems:function(e){return e}},e),{},{searchParameters:g({analytics:!1,analyticsTags:["alg-recommend_".concat(e.model)],clickAnalytics:!1,enableABTest:!1,filters:e.objectIDs.map((function(e){return"NOT objectID:".concat(e)})).join(" AND "),ruleContexts:e.objectIDs.map((function(t){return"alg-recommend_".concat(e.model,"_").concat(t)})),typoTolerance:!1},e.searchParameters)})}(e);return t.searchClient.addAlgoliaAgent("recommend-core","1.0.0-experimental.2"),t.searchClient.initIndex(function(e,t){switch(e){case"bought-together":return"ai_recommend_bought-together_".concat(t);case"related-products":return"ai_recommend_related-products_".concat(t);default:throw new Error("Unknown model: ".concat(JSON.stringify(e),"."))}}(t.model,t.indexName)).getObjects(t.objectIDs).then((function(e){var r=e.results.map((function(e){var t;return null!==(t=null==e?void 0:e.recommendations)&&void 0!==t?t:[]}));return t.searchClient.search(r.map((function(e){var r,n,o,a,c,i=(r={fallbackFilters:t.fallbackFilters,maxRecommendations:t.maxRecommendations,recommendationsCount:e.length},n=r.fallbackFilters,o=r.maxRecommendations,a=r.recommendationsCount,c=n.length>0,0===a?c?o:0:c?o:o>0?Math.min(a,o):a),l=i>0?Math.ceil(i/t.objectIDs.length):i,s=y({fallbackFilters:t.fallbackFilters,recommendations:e,threshold:t.threshold})(t.model);return{indexName:t.indexName,params:g(g(g({hitsPerPage:l},s),t.searchParameters),{},{facetFilters:(s.facetFilters||[]).concat(t.searchParameters.facetFilters||[]),optionalFilters:(s.optionalFilters||[]).concat(t.searchParameters.optionalFilters||[])})}}))).then((function(e){var n,o,a=function(e,t){var r=b(t);return r.sort(e),r}((function(e,t){return(e.__recommendScore||0)<(t.__recommendScore||0)?1:-1}),(n="objectID",o=e.results.flatMap((function(e){return e.hits.map((function(n,o){var a,c=r.flat().find((function(e){return e.objectID===n.objectID}));return g(g({},n),{},{__indexName:t.indexName,__queryID:e.queryID,__position:o+1,__recommendScore:null!==(a=null==c?void 0:c.score)&&void 0!==a?a:null})}))})),b(new Map(o.map((function(e){return[e[n],e]}))).values()))).slice(0,t.maxRecommendations>0?t.maxRecommendations:void 0);return{recommendations:t.transformItems(a)}}))})).catch((function(){return{recommendations:[]}}))}function j(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 w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function P(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 F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function D(e){t.useEffect((function(){e.searchClient.addAlgoliaAgent("recommend-react","1.0.0-experimental.3")}),[e.searchClient])}function E(e){var r=p(t.useState({recommendations:[]}),2),n=r[0],o=r[1];return D({searchClient:e.searchClient}),t.useEffect((function(){var t;(t=e,v(F(F({},t),{},{model:"related-products"}))).then((function(e){o(e)}))}),[e]),n}var N,k,S,C=(N={createElement:t.createElement,Fragment:t.Fragment},k=N.createElement,S=N.Fragment,function(e){var t,r,n,c,m,f=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Frequently bought together",sliderLabel:"Frequently bought together products"},e.translations),d=null!==(t=e.classNames)&&void 0!==t?t:{},p=null!==(r=e.children)&&void 0!==r?r:i({createElement:k,Fragment:S}),b=null!==(n=e.fallbackComponent)&&void 0!==n?n:function(){return null},h=null!==(c=e.headerComponent)&&void 0!==c?c:l({createElement:k,Fragment:S}),y=null!==(m=e.view)&&void 0!==m?m:s({createElement:k,Fragment:S});return p({classNames:d,Fallback:b,Header:h,recommendations:e.items,translations:f,View:function(t){return k(y,o({classNames:d,itemComponent:e.itemComponent,items:e.items,translations:f},t))}})});var I=function(e){var t=e.createElement,r=e.Fragment;return function(e){var n,c,u,f,d,p=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Related products",sliderLabel:"Related products"},e.translations),b=null!==(n=e.classNames)&&void 0!==n?n:{},h=null!==(c=e.children)&&void 0!==c?c:i({createElement:t,Fragment:r}),y=null!==(u=e.fallbackComponent)&&void 0!==u?u:function(){return null},O=null!==(f=e.headerComponent)&&void 0!==f?f:l({createElement:t,Fragment:r}),g=null!==(d=e.view)&&void 0!==d?d:s({createElement:t,Fragment:r});return h({classNames:b,Fallback:y,Header:O,recommendations:e.items,translations:p,View:function(r){return t(g,o({classNames:b,itemComponent:e.itemComponent,items:e.items,translations:p},r))}})}}({createElement:t.createElement,Fragment:t.Fragment});e.FrequentlyBoughtTogether=function(e){var t=E(e).recommendations;return n.default.createElement(C,o({},e,{items:t}))},e.RelatedProducts=function(e){var t=E(e).recommendations;return n.default.createElement(I,o({},e,{items:t}))},e.useFrequentlyBoughtTogether=function(e){var r=p(t.useState({recommendations:[]}),2),n=r[0],o=r[1];return D({searchClient:e.searchClient}),t.useEffect((function(){var t;(t=e,v(w(w({},t),{},{fallbackFilters:[],model:"bought-together"}))).then((function(e){o(e)}))}),[e]),n},e.useRecommendations=function(e){var r=p(t.useState({recommendations:[]}),2),n=r[0],o=r[1];return D({searchClient:e.searchClient}),t.useEffect((function(){v(e).then((function(e){o(e)}))}),[e]),n},e.useRelatedProducts=E,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
/*! @algolia/recommend-react 1.0.0-experimental.4 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/ui-components */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend-react"]={},e.React)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}function i(e){var t=e.createElement;return function(e){return 0===e.recommendations.length?t(e.Fallback,null):t("section",{className:c("auc-Recommend",e.classNames.root)},t(e.Header,{classNames:e.classNames,recommendations:e.recommendations,translations:e.translations}),t(e.View,null))}}function l(e){var t=e.createElement;return function(e){return e.translations.title?t("h3",{className:c("auc-Recommend-title",e.classNames.title)},e.translations.title):null}}function s(e){var t=e.createElement;return function(e){return t("div",{className:c("auc-Recommend-container",e.classNames.container)},t("ol",{className:c("auc-Recommend-list",e.classNames.list)},e.items.map((function(r){return t("li",{key:r.objectID,className:c("auc-Recommend-item",e.classNames.item)},t(e.itemComponent,{item:r}))}))))}}function u(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 m(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 f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var n,o,a=[],c=!0,i=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);c=!0);}catch(e){i=!0,o=e}finally{try{c||null==r.return||r.return()}finally{if(i)throw o}}return a}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var t=e.fallbackFilters,r=e.recommendations,n=e.threshold;if(0===r.length)return t;var o=r.filter((function(e){return e.score>n})).map((function(e){var t=e.objectID,r=e.score;return"objectID:".concat(t,"<score=").concat(100*r,">")}));return[].concat(b(o),b(t))}function y(e){return function(t){switch(t){case"bought-together":return o=(n=e).fallbackFilters,a=n.recommendations,c=n.threshold,0===o.length?{facetFilters:[a.filter((function(e){return e.score>c})).map((function(e){return"objectID:".concat(e.objectID)}))]}:{optionalFilters:h({fallbackFilters:o,recommendations:a,threshold:c})};case"related-products":return{optionalFilters:h({fallbackFilters:(r=e).fallbackFilters,recommendations:r.recommendations,threshold:r.threshold})};default:throw new Error("Unknown model: ".concat(JSON.stringify(t),"."))}var r,n,o,a,c}}function O(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 g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e){var t=function(e){return g(g({fallbackFilters:[],maxRecommendations:0,threshold:0,transformItems:function(e){return e}},e),{},{searchParameters:g({analytics:!1,analyticsTags:["alg-recommend_".concat(e.model)],clickAnalytics:!1,enableABTest:!1,filters:e.objectIDs.map((function(e){return"NOT objectID:".concat(e)})).join(" AND "),ruleContexts:e.objectIDs.map((function(t){return"alg-recommend_".concat(e.model,"_").concat(t)})),typoTolerance:!1},e.searchParameters)})}(e);return t.searchClient.addAlgoliaAgent("recommend-core","1.0.0-experimental.2"),t.searchClient.initIndex(function(e,t){switch(e){case"bought-together":return"ai_recommend_bought-together_".concat(t);case"related-products":return"ai_recommend_related-products_".concat(t);default:throw new Error("Unknown model: ".concat(JSON.stringify(e),"."))}}(t.model,t.indexName)).getObjects(t.objectIDs).then((function(e){var r=e.results.map((function(e){var t;return null!==(t=null==e?void 0:e.recommendations)&&void 0!==t?t:[]}));return t.searchClient.search(r.map((function(e){var r,n,o,a,c,i=(r={fallbackFilters:t.fallbackFilters,maxRecommendations:t.maxRecommendations,recommendationsCount:e.length},n=r.fallbackFilters,o=r.maxRecommendations,a=r.recommendationsCount,c=n.length>0,0===a?c?o:0:c?o:o>0?Math.min(a,o):a),l=i>0?Math.ceil(i/t.objectIDs.length):i,s=y({fallbackFilters:t.fallbackFilters,recommendations:e,threshold:t.threshold})(t.model);return{indexName:t.indexName,params:g(g(g({hitsPerPage:l},s),t.searchParameters),{},{facetFilters:(s.facetFilters||[]).concat(t.searchParameters.facetFilters||[]),optionalFilters:(s.optionalFilters||[]).concat(t.searchParameters.optionalFilters||[])})}}))).then((function(e){var n,o,a=function(e,t){var r=b(t);return r.sort(e),r}((function(e,t){return(e.__recommendScore||0)<(t.__recommendScore||0)?1:-1}),(n="objectID",o=e.results.flatMap((function(e){return e.hits.map((function(n,o){var a,c=r.flat().find((function(e){return e.objectID===n.objectID}));return g(g({},n),{},{__indexName:t.indexName,__queryID:e.queryID,__position:o+1,__recommendScore:null!==(a=null==c?void 0:c.score)&&void 0!==a?a:null})}))})),b(new Map(o.map((function(e){return[e[n],e]}))).values()))).slice(0,t.maxRecommendations>0?t.maxRecommendations:void 0);return{recommendations:t.transformItems(a)}}))})).catch((function(){return{recommendations:[]}}))}function j(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 w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function P(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 F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function D(e){t.useEffect((function(){e.searchClient.addAlgoliaAgent("recommend-react","1.0.0-experimental.4")}),[e.searchClient])}function E(e){var r=p(t.useState({recommendations:[]}),2),n=r[0],o=r[1];return D({searchClient:e.searchClient}),t.useEffect((function(){var t;(t=e,v(w(w({},t),{},{fallbackFilters:[],model:"bought-together"}))).then((function(e){o(e)}))}),[e]),n}var N,k,S,C=(N={createElement:t.createElement,Fragment:t.Fragment},k=N.createElement,S=N.Fragment,function(e){var t,r,n,c,m,f=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Frequently bought together",sliderLabel:"Frequently bought together products"},e.translations),d=null!==(t=e.classNames)&&void 0!==t?t:{},p=null!==(r=e.children)&&void 0!==r?r:i({createElement:k,Fragment:S}),b=null!==(n=e.fallbackComponent)&&void 0!==n?n:function(){return null},h=null!==(c=e.headerComponent)&&void 0!==c?c:l({createElement:k,Fragment:S}),y=null!==(m=e.view)&&void 0!==m?m:s({createElement:k,Fragment:S});return p({classNames:d,Fallback:b,Header:h,recommendations:e.items,translations:f,View:function(t){return k(y,o({classNames:d,itemComponent:e.itemComponent,items:e.items,translations:f},t))}})});function I(e){var r=p(t.useState({recommendations:[]}),2),n=r[0],o=r[1];return D({searchClient:e.searchClient}),t.useEffect((function(){var t;(t=e,v(F(F({},t),{},{model:"related-products"}))).then((function(e){o(e)}))}),[e]),n}var _=function(e){var t=e.createElement,r=e.Fragment;return function(e){var n,c,u,f,d,p=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Related products",sliderLabel:"Related products"},e.translations),b=null!==(n=e.classNames)&&void 0!==n?n:{},h=null!==(c=e.children)&&void 0!==c?c:i({createElement:t,Fragment:r}),y=null!==(u=e.fallbackComponent)&&void 0!==u?u:function(){return null},O=null!==(f=e.headerComponent)&&void 0!==f?f:l({createElement:t,Fragment:r}),g=null!==(d=e.view)&&void 0!==d?d:s({createElement:t,Fragment:r});return h({classNames:b,Fallback:y,Header:O,recommendations:e.items,translations:p,View:function(r){return t(g,o({classNames:b,itemComponent:e.itemComponent,items:e.items,translations:p},r))}})}}({createElement:t.createElement,Fragment:t.Fragment});e.FrequentlyBoughtTogether=function(e){var t=E(e).recommendations;return n.default.createElement(C,o({},e,{items:t}))},e.RelatedProducts=function(e){var t=I(e).recommendations;return n.default.createElement(_,o({},e,{items:t}))},e.useFrequentlyBoughtTogether=E,e.useRecommendations=function(e){var r=p(t.useState({recommendations:[]}),2),n=r[0],o=r[1];return D({searchClient:e.searchClient}),t.useEffect((function(){v(e).then((function(e){o(e)}))}),[e]),n},e.useRelatedProducts=I,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@algolia/recommend-react", | ||
"description": "Horizontal slider UI component.", | ||
"version": "1.0.0-experimental.3", | ||
"version": "1.0.0-experimental.4", | ||
"license": "MIT", | ||
@@ -32,4 +32,4 @@ "homepage": "https://github.com/algolia/ui-components", | ||
"dependencies": { | ||
"@algolia/recommend-core": "1.0.0-experimental.3", | ||
"@algolia/recommend-vdom": "1.0.0-experimental.3" | ||
"@algolia/recommend-core": "1.0.0-experimental.4", | ||
"@algolia/recommend-vdom": "1.0.0-experimental.4" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
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
76150
+ Added@algolia/recommend-core@1.0.0-experimental.4(transitive)
+ Added@algolia/recommend-vdom@1.0.0-experimental.4(transitive)
- Removed@algolia/recommend-core@1.0.0-experimental.3(transitive)
- Removed@algolia/recommend-vdom@1.0.0-experimental.3(transitive)