PageSourceSearch

https://www.puratos.ke/etc.clientlibs/settings/wcm/designs/puratos…/static/js/recipeList.02b341e1.chunk.js

js puratos.ke collected 2026-10-05 05:25:50 UTC 15,574 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkpuratos_react=self.webpackChunkpuratos_react||[]).push([[485,9845],{79635(e,t,r){r.r(t),r.d(t,{default:()=>$});var n=r(96540),o=r(5556),i=r(82960),a=r(19115),s=r(54585),l=r(79393),c=r(66797),d=r(8845);const p=o.shape({addRemark:o.string,ingredientLabel:o.string,ingredientPercentage:o.string,ingredientProductLink:o.string,ingredientType:o.string,ingredientProductLinkPIM:o.string,ingredientUnits:o.string,ingredientUnitsTrans:o.string,label:o.bool,link:o.bool,productDetails:o.shape(d.W)}),u=o.shape({groupTotalLabel:o.string,groupTotalUnits:o.string,hideTotalUnits:o.bool,ingredients:o.arrayOf(p)}),g={empty:o.bool,groups:o.arrayOf(u),ingredientRemarkPercentage:o.string,ingredientRemarkUnits:o.string,ingredientsRemark:o.string,percentageHeader:o.string,showPercentage:o.bool,unitsHeader:o.string};var h=r(66977),m=r(51044),b=r(60040),f=r(95786),v=r(67597),y=r(6664),j=r(51701),x=r(99792),P=r(5864),w=r(7790),O=r(31977),k=r(74848);function N(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 T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach(function(t){L(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function L(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(e){var t;let{row:r,showPercentageValues:o,showAddToCart:i,translate:l,position:c}=e;const d=(0,a.useSelector)(b.B$),p=(0,a.useSelector)(y.D9),u=null===r||void 0===r||null===(t=r.productDetails)||void 0===t?void 0:t.variationsList.map(e=>T(T({},e),{},{aemProdName:r.ingredientLabel})),g=(0,a.useSelector)(b.u6),N=r.productDetails||r.productReference,L=()=>{(0,f.V)(u,v.v.recipe,!0,d,p,c),j.v.selectItem({user_id:d,page_language:(0,s.wq)(),email_address:(0,x.M3)()?g:"",login_status:d?P.y.LOGGED_IN:P.y.GUEST,website_section:w.k.recipe,items:(0,O.L_)(u,p,v.v.recipe)})};return(0,k.jsx)(n.Fragment,{children:r&&r.ingredientLabel&&(0,k.jsxs)("tr",{children:[(0,k.jsxs)("td",{className:"p-table-text p-relative ".concat(i&&r.link&&N?"flex":""),children:[r.link?(0,k.jsxs)("a",{className:"p-text-color-red",href:r.ingredientProductLink,onClick:L,onMouseDown:e=>1===e.button&&L(),children:[r.ingredientLabel," ",r.addRemark]}):(0,k.jsxs)(k.Fragment,{children:[r.ingredientLabel," ",r.addRemark]}),i&&r.link&&N&&(0,k.jsx)(m.N8,{type:v.v.recipe,children:(0,k.jsx)(h.h,{product:r.productDetails||r.productReference,isNewPdp:!!r.productReference,padding:!0,inverted:!0,small:!0,label:l("Add to cart"),absolute:!1,useHasPrice:!1})})]}),(0,k.jsx)("td",{className:"text-right p-table-text",children:r.ingredientUnits}),o&&(0,k.jsx)("td",{className:"text-right p-table-text",children:r.ingredientPercentage})]})})}function D(e){let{homepage:t,group:r,showPercentageValues:o,translate:i}=e;return(0,k.jsxs)(n.Fragment,{children:[r&&r.groupTotalLabel&&(0,k.jsx)("tr",{children:(0,k.jsx)("th",{className:"".concat(t.rtlLanguage?"text-right":"text-left"," p-table-head"),colSpan:o?"3":"2",children:r.groupTotalLabel})}),r&&r.ingredients&&r.ingredients.map((e,r)=>(0,k.jsx)(S,{row:e,translate:i,showAddToCart:t.enableRecipeAddToCart,position:r+1,showPercentageValues:o},e.ingredientLabel)),r&&!r.hideTotalUnits&&(0,k.jsxs)("tr",{className:"info",children:[(0,k.jsxs)("td",{className:"p-table-text",children:[r.groupTotalLabel," ",i("Total")]}),(0,k.jsx)("td",{className:"text-right p-table-text",children:r.groupTotalUnits}),o&&(0,k.jsx)("td",{className:"text-right p-table-text"})]})]})}var I=r(13956),C=r(92848),_=r(23676),E=r(45037),R=r(50285),A=r(83943),M=r(8576),U=r(32809),H=r(80221),B=r(52306);function F(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]:{};
1t%2?F(Object(r),!0).forEach(function(t){q(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function q(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class V extends n.Component{constructor(){super(...arguments),q(this,"setImpressions",e=>{var t;const r=null===(t=e.groups)||void 0===t?void 0:t.map(e=>{var t;return null===(t=e.ingredients)||void 0===t?void 0:t.filter(e=>null!==e.productDetails).map(e=>G(G({},e.productDetails),{},{title:e.ingredientLabel}))});if(r){const e=[].concat.apply([],r);this.props.setProductImpressions({products:e,list:B.IJ.RECIPE_LIST,type:v.v.recipe})}}),q(this,"onClick",e=>{var t;if(e&&e.preventDefault(),!(0,x.M3)())return void this.props.redirectToLogin();const r=null===(t=this.props.resource)||void 0===t||null===(t=t.linkedProductsIngredientModel)||void 0===t?void 0:t.filter(e=>"LINK"===e.ingredientType),n=null===r||void 0===r?void 0:r.map(e=>{let{productDetails:t,productReference:r}=e;return(null===t||void 0===t?void 0:t.productId)||(null===r||void 0===r?void 0:r.id)}).filter(e=>!!e),o=this.props.translate;n.length&&this.props.openModal(C.d,{productIds:[...new Set(n)],hideCartAmountAlert:!0,addAll:!0,showBundles:!0,translate:o,type:v.v.recipe})})}componentDidMount(){this.setImpressions(this.props.resource)}componentDidUpdate(e){e.resource!==this.props.resource&&this.setImpressions(this.props.resource)}render(){var e,t;const{resourceLoading:r,resource:o,homepage:i,translate:a}=this.props;if(!r&&(!o||o.empty))return null;const s=(null===o||void 0===o||null===(e=o.linkedProductsIngredientModel)||void 0===e?void 0:e.length)>0||!1;return(0,k.jsx)(n.Fragment,{children:(0,k.jsxs)(H.S,{loading:r,skeletonType:U.N.RECIPE_LIST,children:[(0,k.jsx)("div",{className:"well p-margin-none",children:(0,k.jsxs)("table",{className:"table table-condensed p-margin-none",children:[(0,k.jsx)("thead",{children:(0,k.jsxs)("tr",{children:[(0,k.jsx)("th",{width:"60%"}),(0,k.jsx)("th",{width:o.showPercentage&&null!=o.percentageHeader?"25%":"40%",className:"text-right p-table-text--header",children:o.unitsHeader}),o.showPercentage&&null!=o.percentageHeader&&(0,k.jsx)("th",{width:"15%",className:"text-right p-table-text--header",children:o.percentageHeader})]})}),(0,k.jsx)("tbody",{children:null===o||void 0===o||null===(t=o.groups)||void 0===t?void 0:t.map(e=>(0,k.jsx)(D,{group:e,translate:a,homepage:i,showPercentageValues:o.showPercentage},e.groupTotalLabel))}),o.ingredientsRemark&&(0,k.jsx)("tfoot",{children:(0,k.jsxs)("tr",{children:[(0,k.jsxs)("td",{className:"p-table-text--footer",children:[(0,k.jsx)("span",{children:"*"})," ",o.ingredientsRemark]}),(0,k.jsx)("td",{className:"text-right p-table-text--footer",children:o.ingredientRemarkUnits}),o.showPercentage&&null!=o.percentageHeader&&(0,k.jsx)("td",{className:"text-right p-table-text--footer",children:o.ingredientRemarkPercentage})]})})]})}),(0,k.jsx)(M.a,{children:(0,k.jsx)(M.a.Fragment,{roles:[x.gg.valid,x.gg.new,x.gg.loggedOut],
1children:i.enableRecipeAddToCart&&s&&(0,k.jsxs)(I.$,{color:I.$.colors.SECONDARY,onClick:()=>this.onClick(),className:"p-margin-top-md p-padding-right-md",children:[(0,k.jsx)(_.In,{type:_.TT.shoppingCart,className:"p-margin-right-sm p-margin-left-sm"})," ",a("Add all Puratos ingredients")]})})})]})})}}q(V,"propTypes",{resource:o.shape(g),resourceLoading:o.bool}),q(V,"defaultProps",{resourceLoading:!0});const $=(0,i.Zz)((0,a.connect)((e,t)=>({resource:(0,s.W_)(e,t.model)||{},homepage:(0,s.VX)(e),resourceLoading:(0,l.DG)(e,t.model)}),{openModal:E.qf,redirectToLogin:R.C8,setProductImpressions:A.u4}),c.lI)(V)},66977(e,t,r){r.d(t,{h:()=>F});var n=r(96540),o=r(5556),i=r.n(o),a=r(99792),s=r(19115),l=r(45037),c=r(2458),d=r(60040),p=r(96267),u=r(20666),g=r(62274),h=r(74692),m=r(51044),b=r(95786),f=r(69727),v=r(87055),y=r(76948),j=r(6664),x=r(51701),P=r(54585),w=r(5864),O=r(7790),k=r(31977),N=r(48931),T=r(74848);function L(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 S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach(function(t){D(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function D(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const I="product-ordering";g.P.modals[I]=function(e){const[t,r]=(0,n.useState)(null),[o,i]=(0,n.useState)(!1),l=(0,s.useSelector)(d.B$),c=(0,s.use
1Selector)(j.D9),g=(0,s.useSelector)(d.u6),L=(0,s.useDispatch)();return(0,n.useEffect)(()=>{(0,a.hf)(a.gg.valid)&&(i(!0),(0,N.P)(e.payload.productId).then(e=>r(e)).catch(e=>{console.error("Failed to fetch product SKU data:",e),r([])}).finally(()=>i(!1)),L((0,v.w$)([e.payload.productId])))},[e.payload.productId]),(0,n.useEffect)(()=>{const e=h("body");return e.addClass("modal-open"),()=>e.removeClass("modal-open")}),(0,T.jsx)(p.P,{skus:t,loading:o,title:"Select package",children:(0,T.jsx)(m.N8,{type:e.payload.type,children:t&&(0,T.jsx)(u.A,{sku:t,addEvent:t=>{L((0,f.EG)(S(S({},t),{},{type:(0,y.GU)(e.payload.type)}))),(0,b.V)(t,e.payload.type,!0,l,c,1),x.v.selectItem({user_id:l,page_language:(0,P.wq)(),email_address:(0,a.M3)()?g:"",login_status:l?w.y.LOGGED_IN:w.y.GUEST,website_section:O.k.allProducts,items:(0,k.L_)(t,c,e.payload.type)})},showBundles:!0,hideCartAmountAlert:e.payload.hideCartAmountAlert,productCategoryTag:e.payload.productCategoryTag})})})};var C=r(94671),_=r(8576),E=r(52819),R=r(5047),A=r(94290),M=r(90251);function U(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class H extends n.Component{constructor(e){super(e),U(this,"fetchMaterials",async(e,t)=>(await Promise.all(e.map(async e=>{const[r,n]=await Promise.allSettled([(0,A.Q)(e,(0,P.ay)()),(0,A.S)(e)]),o="fulfilled"===r.status?r.value:null,i="fulfilled"===n.status?n.value:null;if(!o)return null;const a=(0,M.PQ)(o,i,t);return a&&"rejected"===n.status&&(a.hasPrice=!1),a}))).filter(Boolean)),U(this,"handleMouseHover",()=>{this.props.label&&this.setState(this.toggleHoverState)}),U(this,"toggleHoverState",e=>({showLabel:!e.showLabel})),U(this,"onClick",e=>{e&&e.preventDefault(),this.props.openModal(I,{productId:this.props.product.id||this.props.product.aemId||this.props.product.productId,hideCartAmountAlert:!0,type:this.context,productCategoryTag:this.props.product.productCategoryTag||""})}),this.state={showLabel:!1,materials:null}}async componentDidMount(){var e;const{product:t,isNewPdp:r}=this.props,n=t.id||t.aemId||t.productId,o=(null===t||void 0===t||null===(e=t.packagings)||void 0===e?void 0:e.map(e=>
1e.code).filter(Boolean))||[];if(r&&t&&n&&(0,a.M3)()&&o.length>0)try{const e=await this.fetchMaterials(o,n);this.setState({materials:e})}catch(i){console.error("Error fetching materials:",i)}}render(){var e,t;const r=this.state.materials,n=r&&r.some(e=>e.hasPrice),o=r&&r.every(e=>e.isObsolete),{loginUrl:i,product:s,isFinder:l=!1,small:d,inverted:p,label:u,padding:g,absolute:h,homepage:m,useHasPrice:b=!0,isBlocksale:f=!1}=this.props,{showLabel:v}=this.state;if(!s)return null;const{materials:y,packagings:j}=s,x=s.hasPrice||n,P=s.isObsolete||o,w=!!(y&&y[0]&&y[0].materialNumber)||!!(j&&j[0]&&j[0].code),O=P||b&&!x||l&&!w||f,k=b&&!x&&!P,N=(null===s||void 0===s?void 0:s.materialNumber)||(null===s||void 0===s?void 0:s.variationsList)&&(null===s||void 0===s||null===(e=s.variationsList[0])||void 0===e?void 0:e.materialNumber)||(null===s||void 0===s?void 0:s.packagings)&&(null===(t=s.packagings[0])||void 0===t?void 0:t.code),L=m?(0,T.jsxs)("div",{className:"p-padding-sm text-center",children:[m.accompanyingButtonText&&(0,T.jsx)("p",{dangerouslySetInnerHTML:{__html:k?m.accompanyingButtonText:m.obsoleteProduct},className:k?"":"p-margin-none"}),k&&(0,T.jsx)(R.p,{productId:N})]}):null;return(0,T.jsx)(c.A,{requireEcom:!0,children:(0,T.jsxs)(_.a,{children:[(0,T.jsx)(_.a.Fragment,{roles:a.gg.connected,children:(0,T.jsxs)(E.A,{placement:"auto",trigger:"hover",tooltip:L,delayHide:125,triggerClassName:"btn-add-to-cart__wrapper",disabled:!u||!b&&!P||b&&!P&&x||l||!L,children:[(0,T.jsx)("a",{className:"btn-add-to-cart ".concat(O?"disabled":""," ").concat(g?"p-margin-left-sm":""," ").concat(d?"small":""),href:"#!",onClick:()=>this.onClick(),children:(0,T.jsx)("span",{className:"btn-add-to-cart__holder btn-add-to-cart__icon ".concat(d?"small":"")})}),v&&!O&&(0,T.jsx)("span",{className:"btn-label ".concat(h?"btn-label-absolute":null),children:u})]})}),(0,T.jsx)(_.a.Fragment,{roles:a.gg.loggedOut,children:(0,T.jsx)("a",{className:"btn-add-to-cart ".concat(O?"disabled":""," ").concat(g?"p-margin-left-sm":""," ").concat(d?"small":""),href:i,children:(0,T.jsx)("span",{className:"btn-add-to-cart__holder btn-add-to-cart__icon ".concat(d?"small":"")})})})]})})}}U(H,"contextType",m.qe),U(H,"propTypes",{product:i().shape(C.ch).isRequired,loginUrl:i().string,openModal:i().func.isRequired,redirectToLogin:i().func,useHasPrice:i().bool,isDisabled:i().bool});const B={openModal:l.qf},F=(0,s.connect)(e=>({loggedIn:(0,d.x3)(e),loginUrl:(0,d.DA)(e),homepage:(0,P.VX)(e)}),B)(H)},8845(e,t,r){r.d(t,{W:()=>i,r:()=>o});var n=r(5556);const o={materialNumber:n.string,toggleButtonText:n.string,description:n.string,storage:n.string,packaging:n.string,shelfLife:n.string,palletisation:n.string,orderable:n.bool,extraLabel:n.arrayOf(n.shape({label:n.string,value:n.string,empty:n.bool})),empty:n.bool},i={componentTitle:n.string,productId:n.string,variationsList:n.arrayOf(n.shape(o))}}}]);
2//# sourceMappingURL=recipeList.02b341e1.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.