@salla.sa/twilight-components 2.13.55 → 2.13.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cjs/{app-globals-db36c588.js → app-globals-9d2c1cb5.js} +2 -2
  2. package/dist/cjs/app-globals-9d2c1cb5.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
  5. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  6. package/dist/cjs/salla-reviews.cjs.entry.js.map +1 -1
  7. package/dist/cjs/twilight.cjs.js +1 -1
  8. package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
  9. package/dist/collection/components/salla-reviews/salla-reviews.js.map +1 -1
  10. package/dist/components/index.js +1 -1
  11. package/dist/components/index.js.map +1 -1
  12. package/dist/components/salla-quick-buy2.js.map +1 -1
  13. package/dist/components/salla-reviews.js +1 -1
  14. package/dist/components/salla-reviews.js.map +1 -1
  15. package/dist/esm/{app-globals-29abf3e3.js → app-globals-ebede509.js} +2 -2
  16. package/dist/esm/app-globals-ebede509.js.map +1 -0
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
  19. package/dist/esm/salla-reviews.entry.js +1 -1
  20. package/dist/esm/salla-reviews.entry.js.map +1 -1
  21. package/dist/esm/twilight.js +1 -1
  22. package/dist/esm-es5/{app-globals-29abf3e3.js → app-globals-ebede509.js} +2 -2
  23. package/dist/esm-es5/{app-globals-29abf3e3.js.map → app-globals-ebede509.js.map} +1 -1
  24. package/dist/esm-es5/loader.js +1 -1
  25. package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
  26. package/dist/esm-es5/salla-reviews.entry.js +1 -1
  27. package/dist/esm-es5/salla-reviews.entry.js.map +1 -1
  28. package/dist/esm-es5/twilight.js +1 -1
  29. package/dist/twilight/{p-546db59b.entry.js → p-01bb73c0.entry.js} +2 -2
  30. package/dist/twilight/{p-546db59b.entry.js.map → p-01bb73c0.entry.js.map} +1 -1
  31. package/dist/twilight/{p-a7b263b2.system.js → p-0214de39.system.js} +2 -2
  32. package/dist/twilight/{p-a7b263b2.system.js.map → p-0214de39.system.js.map} +1 -1
  33. package/dist/twilight/{p-f51c9acb.system.js → p-3d7db383.system.js} +2 -2
  34. package/dist/twilight/p-5be05a17.system.entry.js.map +1 -1
  35. package/dist/twilight/{p-2866def3.system.entry.js → p-989d0264.system.entry.js} +2 -2
  36. package/dist/twilight/{p-2866def3.system.entry.js.map → p-989d0264.system.entry.js.map} +1 -1
  37. package/dist/twilight/p-bc7cb3df.entry.js.map +1 -1
  38. package/dist/twilight/{p-06221496.js → p-f6f43db8.js} +2 -2
  39. package/dist/twilight/{p-06221496.js.map → p-f6f43db8.js.map} +1 -1
  40. package/dist/twilight/twilight.esm.js +1 -1
  41. package/dist/twilight/twilight.js +1 -1
  42. package/package.json +5 -5
  43. package/dist/cjs/app-globals-db36c588.js.map +0 -1
  44. package/dist/esm/app-globals-29abf3e3.js.map +0 -1
  45. /package/dist/twilight/{p-f51c9acb.system.js.map → p-3d7db383.system.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- System.register(["./p-a0dabf35.system.js","./p-910b705d.system.js","./p-af17aa74.system.js","./p-8f7b9e36.system.js"],(function(s){"use strict";var e,i,t,a;return{setters:[function(s){e=s.r;i=s.h},function(s){t=s.a},function(s){a=s.H},function(){}],execute:function(){var l='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>quote-open</title>\n<path d="M8 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM12 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4zM25.333 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM29.333 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n';var n="";var r=s("salla_reviews",function(){function s(s){var i=this;e(this,s);this.displayAllURL=null;this.displayAllLink=undefined;this.source=undefined;this.sourceValue=undefined;this.limit=5;this.type="store";this.sort="latest";this.hideCustomerInfo=false;this.reviews=[];this.isRTL=undefined;this.showReviews=false;this.testimonialText=salla.lang.get("blocks.home.testimonials");this.displayAllLinkText=salla.lang.get("blocks.home.display_all");this.source=this.source;salla.onReady((function(){i.displayAllURL=salla.url.get("testimonials");i.isRTL=salla.config.get("theme.is_rtl",true)}));salla.lang.onLoaded((function(){i.testimonialText=salla.lang.get("blocks.home.testimonials");i.displayAllLinkText=salla.lang.get("blocks.home.display_all")}))}s.prototype.fetchReviews=function(){if(this.source==="json"){return Promise.resolve(JSON.parse(this.sourceValue))}var s=["products","categories"].includes(this.source);var e={limit:this.limit,source:this.source,items:s?JSON.parse(this.sourceValue):this.sourceValue,sort:this.sort,type:this.type,hide_customer_info:this.hideCustomerInfo};return salla.api.request("reviews",{params:e},"get")};s.prototype.componentWillLoad=function(){var s=this;return new Promise((function(s){return salla.onReady(s)})).then((function(){return s.fetchReviews()})).then((function(s){return s.data||[]})).then((function(e){if(e.length){s.reviews=e;s.showReviews=true;a.generateReviewSchema(s.reviews)}}))};s.prototype.render=function(){return i("div",{class:"s-reviews-container"},i("div",{class:"s-reviews-header-wrapper"},i("h1",{class:"s-reviews-header"},this.testimonialText),!!this.displayAllLink?i("a",{href:this.displayAllURL,class:"s-reviews-display-all"},this.displayAllLinkText,i("span",{class:"s-reviews-display-all-icon",innerHTML:t})):null),i("salla-slider",{centered:true,"slides-per-view":1,type:"testimonials",class:"s-reviews-testimonials-slider","controls-outer":true,"auto-play":true,id:"testimonials-".concat(this.source,"-slider")},i("div",{slot:"items"},this.reviews.map((function(s,e){return i("div",{key:e,class:"s-reviews-swiper-slide"},i("div",{class:"s-reviews-testimonial"},i("div",{class:"s-reviews-testimonial__inner"},i("div",{class:"s-reviews-testimonial__avatar"},i("img",{src:"images/s-empty.png","data-src":s.avatar,alt:s.name?s.name:"testimonial-"+e,class:"lazy"})),i("div",{class:"s-reviews-testimonial__text"},i("p",null,s.content),i("div",{class:"s-reviews-testimonial__name_wrapper"},i("div",{class:"s-reviews-testimonial__info"},s.name&&i("h2",null,"".concat(s.name))),i("div",{class:"s-reviews-testimonial__rating"},i("salla-rating-stars",{size:"small",value:s.stars})))),i("span",{class:"s-reviews-testimonial__icon",innerHTML:l}))))})))))};return s}());r.style=n}}}));
5
- //# sourceMappingURL=p-2866def3.system.entry.js.map
4
+ System.register(["./p-a0dabf35.system.js","./p-910b705d.system.js","./p-af17aa74.system.js","./p-8f7b9e36.system.js"],(function(s){"use strict";var e,i,t,a;return{setters:[function(s){e=s.r;i=s.h},function(s){t=s.a},function(s){a=s.H},function(){}],execute:function(){var l='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>quote-open</title>\n<path d="M8 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM12 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4zM25.333 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM29.333 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n';var n="";var r=s("salla_reviews",function(){function s(s){var i=this;e(this,s);this.displayAllURL=null;this.displayAllLink=undefined;this.source=undefined;this.sourceValue=undefined;this.limit=5;this.type="store";this.sort="latest";this.hideCustomerInfo=false;this.reviews=[];this.isRTL=undefined;this.showReviews=false;this.testimonialText=salla.lang.get("blocks.home.testimonials");this.displayAllLinkText=salla.lang.get("blocks.home.display_all");this.source=this.source;salla.onReady((function(){i.displayAllURL=salla.url.get("testimonials");i.isRTL=salla.config.get("theme.is_rtl",true)}));salla.lang.onLoaded((function(){i.testimonialText=salla.lang.get("blocks.home.testimonials");i.displayAllLinkText=salla.lang.get("blocks.home.display_all")}))}s.prototype.fetchReviews=function(){if(this.source==="json"){return Promise.resolve(JSON.parse(this.sourceValue))}var s=["products","categories"].includes(this.source);var e={limit:this.limit,source:this.source,items:s?JSON.parse(this.sourceValue):this.sourceValue,sort:this.sort,type:this.type,hide_customer_info:this.hideCustomerInfo?1:0};return salla.api.request("reviews",{params:e},"get")};s.prototype.componentWillLoad=function(){var s=this;return new Promise((function(s){return salla.onReady(s)})).then((function(){return s.fetchReviews()})).then((function(s){return s.data||[]})).then((function(e){if(e.length){s.reviews=e;s.showReviews=true;a.generateReviewSchema(s.reviews)}}))};s.prototype.render=function(){return i("div",{class:"s-reviews-container"},i("div",{class:"s-reviews-header-wrapper"},i("h1",{class:"s-reviews-header"},this.testimonialText),!!this.displayAllLink?i("a",{href:this.displayAllURL,class:"s-reviews-display-all"},this.displayAllLinkText,i("span",{class:"s-reviews-display-all-icon",innerHTML:t})):null),i("salla-slider",{centered:true,"slides-per-view":1,type:"testimonials",class:"s-reviews-testimonials-slider","controls-outer":true,"auto-play":true,id:"testimonials-".concat(this.source,"-slider")},i("div",{slot:"items"},this.reviews.map((function(s,e){return i("div",{key:e,class:"s-reviews-swiper-slide"},i("div",{class:"s-reviews-testimonial"},i("div",{class:"s-reviews-testimonial__inner"},i("div",{class:"s-reviews-testimonial__avatar"},i("img",{src:"images/s-empty.png","data-src":s.avatar,alt:s.name?s.name:"testimonial-"+e,class:"lazy"})),i("div",{class:"s-reviews-testimonial__text"},i("p",null,s.content),i("div",{class:"s-reviews-testimonial__name_wrapper"},i("div",{class:"s-reviews-testimonial__info"},s.name&&i("h2",null,"".concat(s.name))),i("div",{class:"s-reviews-testimonial__rating"},i("salla-rating-stars",{size:"small",value:s.stars})))),i("span",{class:"s-reviews-testimonial__icon",innerHTML:l}))))})))))};return s}());r.style=n}}}));
5
+ //# sourceMappingURL=p-989d0264.system.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sallaReviewsCss","SallaReviews","exports","class_1","hostRef","_this","this","displayAllURL","salla","lang","get","source","onReady","url","isRTL","config","onLoaded","testimonialText","displayAllLinkText","prototype","fetchReviews","Promise","resolve","JSON","parse","sourceValue","isJsonEncoded","includes","params","limit","items","sort","type","hide_customer_info","hideCustomerInfo","api","request","componentWillLoad","then","resp","data","reviews","length","showReviews","Helper","generateReviewSchema","render","h","class","displayAllLink","href","innerHTML","IconArrowLeft","centered","id","concat","slot","map","item","index","key","src","avatar","alt","name","content","size","value","stars","IconQuoteOpen"],"sources":["src/components/salla-reviews/salla-reviews.scss?tag=salla-reviews","src/components/salla-reviews/salla-reviews.tsx"],"sourcesContent":[null,"import { Component, Prop, State, h } from '@stencil/core';\nimport IconArrowLeft from '../../assets/svg/arrow-left.svg'\nimport IconQuoteOpen from '../../assets/svg/quote-open.svg'\n\nimport {Source, Review, ReviewType, SortingOption} from \"./interfaces\"\nimport Helper from '../../Helpers/Helper';\n\n\n@Component({\n tag: 'salla-reviews',\n styleUrl: 'salla-reviews.scss',\n})\nexport class SallaReviews {\n constructor(){\n this.source = this.source;\n salla.onReady(() => {\n this.displayAllURL = salla.url.get('testimonials')\n this.isRTL = salla.config.get('theme.is_rtl', true)\n })\n\n salla.lang.onLoaded(() => { \n this.testimonialText = salla.lang.get('blocks.home.testimonials')\n this.displayAllLinkText = salla.lang.get('blocks.home.display_all')\n })\n }\n\n /**\n * Controls the visibility of a link to the reviews page.\n * \n * When set to `true`, a link will be displayed allowing users to navigate to the full reviews section.\n * \n * @type {boolean}\n */\n @Prop({ reflect: true }) displayAllLink: boolean\n\n /**\n * Specifies the data source for reviews.\n * \n * Valid options include:\n * - 'categories': Retrieves reviews for specific product categories.\n * - 'products': Retrieves reviews for individual products.\n * - 'json': Retrieves reviews from a custom JSON payload provided in `sourceValue`.\n * \n * When using 'json' as the source, a valid payload must be provided in `sourceValue`.\n * \n * @type {Source}\n * @default \"store\"\n */\n @Prop({ reflect: true }) source?: Source;\n\n /**\n * Provides data specific to the chosen source.\n * \n * Required when using 'categories', 'products', or 'json' as the source:\n * - 'categories': An array of category IDs.\n * - 'products': An array of product IDs.\n * - 'json': A custom JSON object containing review data.\n * \n * @type {string | object | Array<number>}\n */\n @Prop({ reflect: true }) sourceValue?: string | object | Array<number>;\n\n /**\n * Defines the maximum number of reviews to retrieve from the API.\n * \n * @type {number}\n * @default 5\n */\n @Prop({ reflect: true }) limit = 5\n\n\n /**\n * Specifies the type of reviews to fetch.\n * Available options:\n * - \"all\": Fetches reviews from all sources.\n * - \"store\": Fetches reviews specific to the store.\n * - \"products\": Fetches reviews specific to products.\n * \n * @type {ReviewType}\n * @default store\n */\n @Prop() type: ReviewType = \"store\";\n\n\n /**\n * Specifies the sorting criteria for the fetched reviews.\n * Available options:\n * - \"top_rating\": Sorts reviews based on top ratings.\n * - \"random\": Sorts reviews randomly.\n * - \"latest\": Sorts reviews based on the latest ones (default).\n * \n * @type {SortingOption}\n * @default latest\n */\n @Prop() sort: SortingOption = \"latest\";\n\n\n /**\n * Specifies whether to hide customer information in the component.\n * When set to true, customer information will be hidden.\n * Defaults to false, meaning customer information will be displayed.\n */\n @Prop() hideCustomerInfo: boolean = false;\n\n\n @State() reviews: Array<Review> = [];\n @State() isRTL: boolean\n @State() showReviews: boolean = false;\n @State() testimonialText: string = salla.lang.get('blocks.home.testimonials');\n @State() displayAllLinkText: string = salla.lang.get('blocks.home.display_all');\n\n private displayAllURL = null\n\n fetchReviews() {\n if (this.source === 'json') {\n return Promise.resolve(JSON.parse(this.sourceValue as string));\n }\n const isJsonEncoded = ['products', 'categories'].includes(this.source);\n const params = {\n limit: this.limit,\n source: this.source,\n items: isJsonEncoded ? JSON.parse(this.sourceValue as string) : this.sourceValue,\n sort: this.sort,\n type: this.type,\n hide_customer_info: this.hideCustomerInfo\n };\n return salla.api.request('reviews', { params }, 'get');\n }\n\n\n componentWillLoad() {\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => this.fetchReviews())\n .then((resp) => resp.data || [])\n .then(reviews => {\n if (reviews.length) {\n this.reviews = reviews;\n this.showReviews = true;\n Helper.generateReviewSchema(this.reviews);\n }\n });\n }\n\n render() {\n return (\n <div class=\"s-reviews-container\">\n <div class=\"s-reviews-header-wrapper\">\n <h1 class=\"s-reviews-header\">\n {this.testimonialText}\n </h1>\n {!!this.displayAllLink ? (\n <a href={this.displayAllURL} class=\"s-reviews-display-all\">\n {this.displayAllLinkText}\n <span class=\"s-reviews-display-all-icon\" innerHTML={IconArrowLeft} />\n </a>\n ) : null}\n </div>\n <salla-slider\n centered\n slides-per-view={1}\n type=\"testimonials\"\n class=\"s-reviews-testimonials-slider\"\n controls-outer\n auto-play\n id={`testimonials-${this.source}-slider`}\n >\n <div slot=\"items\">\n {this.reviews.map((item: Review, index) => (\n <div key={index} class=\"s-reviews-swiper-slide\">\n <div class=\"s-reviews-testimonial\">\n <div class=\"s-reviews-testimonial__inner\">\n <div class=\"s-reviews-testimonial__avatar\">\n <img\n src={'images/s-empty.png'}\n data-src={item.avatar}\n alt={item.name ? item.name : 'testimonial-' + index}\n class=\"lazy\"\n />\n </div>\n <div class=\"s-reviews-testimonial__text\">\n <p>{item.content}</p>\n <div class=\"s-reviews-testimonial__name_wrapper\">\n <div class=\"s-reviews-testimonial__info\">\n {item.name && <h2>{`${item.name}`}</h2>}\n </div>\n <div class=\"s-reviews-testimonial__rating\">\n {/* TODO stars is missing */}\n <salla-rating-stars size=\"small\" value={item.stars}></salla-rating-stars>\n </div>\n </div>\n </div>\n\n <span class=\"s-reviews-testimonial__icon\" innerHTML={IconQuoteOpen} />\n </div>\n </div>\n </div>\n ))}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n}\n\n"],"mappings":";;;4oCAAA,IAAMA,EAAkB,G,ICYXC,EAAYC,EAAA,2BACvB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,UAkGQA,KAAAC,cAAgB,K,0FA3CS,E,UAaN,Q,UAaG,S,sBAQM,M,aAGF,G,sCAEF,M,qBACGC,MAAMC,KAAKC,IAAI,4B,wBACZF,MAAMC,KAAKC,IAAI,2BA/FnDJ,KAAKK,OAASL,KAAKK,OACnBH,MAAMI,SAAQ,WACZP,EAAKE,cAAgBC,MAAMK,IAAIH,IAAI,gBACnCL,EAAKS,MAAQN,MAAMO,OAAOL,IAAI,eAAgB,K,IAGhDF,MAAMC,KAAKO,UAAS,WAClBX,EAAKY,gBAAkBT,MAAMC,KAAKC,IAAI,4BACtCL,EAAKa,mBAAqBV,MAAMC,KAAKC,IAAI,0B,IA2F7CP,EAAAgB,UAAAC,aAAA,WACE,GAAId,KAAKK,SAAW,OAAQ,CAC1B,OAAOU,QAAQC,QAAQC,KAAKC,MAAMlB,K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,gCACTD,EAAA,OAAKC,MAAM,iCACTD,EAAA,OACEc,IAAK,qBAAoB,WACfH,EAAKI,OACfC,IAAKL,EAAKM,KAAON,EAAKM,KAAO,eAAiBL,EAC9CX,MAAM,UAGVD,EAAA,OAAKC,MAAM,+BACTD,EAAA,SAAIW,EAAKO,SACTlB,EAAA,OAAKC,MAAM,uCACTD,EAAA,OAAKC,MAAM,+BACRU,EAAKM,MAAQjB,EAAA,UAAK,GAAAQ,OAAGG,EAAKM,QAE7BjB,EAAA,OAAKC,MAAM,iCAETD,EAAA,sBAAoBmB,KAAK,QAAQC,MAAOT,EAAKU,WAKnDrB,EAAA,QAAMC,MAAM,8BAA8BG,UAAWkB,MAzBvB,M,WA3JzB,I"}
1
+ {"version":3,"names":["sallaReviewsCss","SallaReviews","exports","class_1","hostRef","_this","this","displayAllURL","salla","lang","get","source","onReady","url","isRTL","config","onLoaded","testimonialText","displayAllLinkText","prototype","fetchReviews","Promise","resolve","JSON","parse","sourceValue","isJsonEncoded","includes","params","limit","items","sort","type","hide_customer_info","hideCustomerInfo","api","request","componentWillLoad","then","resp","data","reviews","length","showReviews","Helper","generateReviewSchema","render","h","class","displayAllLink","href","innerHTML","IconArrowLeft","centered","id","concat","slot","map","item","index","key","src","avatar","alt","name","content","size","value","stars","IconQuoteOpen"],"sources":["src/components/salla-reviews/salla-reviews.scss?tag=salla-reviews","src/components/salla-reviews/salla-reviews.tsx"],"sourcesContent":[null,"import { Component, Prop, State, h } from '@stencil/core';\nimport IconArrowLeft from '../../assets/svg/arrow-left.svg'\nimport IconQuoteOpen from '../../assets/svg/quote-open.svg'\n\nimport {Source, Review, ReviewType, SortingOption} from \"./interfaces\"\nimport Helper from '../../Helpers/Helper';\n\n\n@Component({\n tag: 'salla-reviews',\n styleUrl: 'salla-reviews.scss',\n})\nexport class SallaReviews {\n constructor(){\n this.source = this.source;\n salla.onReady(() => {\n this.displayAllURL = salla.url.get('testimonials')\n this.isRTL = salla.config.get('theme.is_rtl', true)\n })\n\n salla.lang.onLoaded(() => { \n this.testimonialText = salla.lang.get('blocks.home.testimonials')\n this.displayAllLinkText = salla.lang.get('blocks.home.display_all')\n })\n }\n\n /**\n * Controls the visibility of a link to the reviews page.\n * \n * When set to `true`, a link will be displayed allowing users to navigate to the full reviews section.\n * \n * @type {boolean}\n */\n @Prop({ reflect: true }) displayAllLink: boolean\n\n /**\n * Specifies the data source for reviews.\n * \n * Valid options include:\n * - 'categories': Retrieves reviews for specific product categories.\n * - 'products': Retrieves reviews for individual products.\n * - 'json': Retrieves reviews from a custom JSON payload provided in `sourceValue`.\n * \n * When using 'json' as the source, a valid payload must be provided in `sourceValue`.\n * \n * @type {Source}\n * @default \"store\"\n */\n @Prop({ reflect: true }) source?: Source;\n\n /**\n * Provides data specific to the chosen source.\n * \n * Required when using 'categories', 'products', or 'json' as the source:\n * - 'categories': An array of category IDs.\n * - 'products': An array of product IDs.\n * - 'json': A custom JSON object containing review data.\n * \n * @type {string | object | Array<number>}\n */\n @Prop({ reflect: true }) sourceValue?: string | object | Array<number>;\n\n /**\n * Defines the maximum number of reviews to retrieve from the API.\n * \n * @type {number}\n * @default 5\n */\n @Prop({ reflect: true }) limit = 5\n\n\n /**\n * Specifies the type of reviews to fetch.\n * Available options:\n * - \"all\": Fetches reviews from all sources.\n * - \"store\": Fetches reviews specific to the store.\n * - \"products\": Fetches reviews specific to products.\n * \n * @type {ReviewType}\n * @default store\n */\n @Prop() type: ReviewType = \"store\";\n\n\n /**\n * Specifies the sorting criteria for the fetched reviews.\n * Available options:\n * - \"top_rating\": Sorts reviews based on top ratings.\n * - \"random\": Sorts reviews randomly.\n * - \"latest\": Sorts reviews based on the latest ones (default).\n * \n * @type {SortingOption}\n * @default latest\n */\n @Prop() sort: SortingOption = \"latest\";\n\n\n /**\n * Specifies whether to hide customer information in the component.\n * When set to true, customer information will be hidden.\n * Defaults to false, meaning customer information will be displayed.\n */\n @Prop() hideCustomerInfo: boolean = false;\n\n\n @State() reviews: Array<Review> = [];\n @State() isRTL: boolean\n @State() showReviews: boolean = false;\n @State() testimonialText: string = salla.lang.get('blocks.home.testimonials');\n @State() displayAllLinkText: string = salla.lang.get('blocks.home.display_all');\n\n private displayAllURL = null\n\n fetchReviews() {\n if (this.source === 'json') {\n return Promise.resolve(JSON.parse(this.sourceValue as string));\n }\n const isJsonEncoded = ['products', 'categories'].includes(this.source);\n const params = {\n limit: this.limit,\n source: this.source,\n items: isJsonEncoded ? JSON.parse(this.sourceValue as string) : this.sourceValue,\n sort: this.sort,\n type: this.type,\n hide_customer_info: this.hideCustomerInfo?1:0\n };\n return salla.api.request('reviews', { params }, 'get');\n }\n\n\n componentWillLoad() {\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => this.fetchReviews())\n .then((resp) => resp.data || [])\n .then(reviews => {\n if (reviews.length) {\n this.reviews = reviews;\n this.showReviews = true;\n Helper.generateReviewSchema(this.reviews);\n }\n });\n }\n\n render() {\n return (\n <div class=\"s-reviews-container\">\n <div class=\"s-reviews-header-wrapper\">\n <h1 class=\"s-reviews-header\">\n {this.testimonialText}\n </h1>\n {!!this.displayAllLink ? (\n <a href={this.displayAllURL} class=\"s-reviews-display-all\">\n {this.displayAllLinkText}\n <span class=\"s-reviews-display-all-icon\" innerHTML={IconArrowLeft} />\n </a>\n ) : null}\n </div>\n <salla-slider\n centered\n slides-per-view={1}\n type=\"testimonials\"\n class=\"s-reviews-testimonials-slider\"\n controls-outer\n auto-play\n id={`testimonials-${this.source}-slider`}\n >\n <div slot=\"items\">\n {this.reviews.map((item: Review, index) => (\n <div key={index} class=\"s-reviews-swiper-slide\">\n <div class=\"s-reviews-testimonial\">\n <div class=\"s-reviews-testimonial__inner\">\n <div class=\"s-reviews-testimonial__avatar\">\n <img\n src={'images/s-empty.png'}\n data-src={item.avatar}\n alt={item.name ? item.name : 'testimonial-' + index}\n class=\"lazy\"\n />\n </div>\n <div class=\"s-reviews-testimonial__text\">\n <p>{item.content}</p>\n <div class=\"s-reviews-testimonial__name_wrapper\">\n <div class=\"s-reviews-testimonial__info\">\n {item.name && <h2>{`${item.name}`}</h2>}\n </div>\n <div class=\"s-reviews-testimonial__rating\">\n {/* TODO stars is missing */}\n <salla-rating-stars size=\"small\" value={item.stars}></salla-rating-stars>\n </div>\n </div>\n </div>\n\n <span class=\"s-reviews-testimonial__icon\" innerHTML={IconQuoteOpen} />\n </div>\n </div>\n </div>\n ))}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n}\n\n"],"mappings":";;;4oCAAA,IAAMA,EAAkB,G,ICYXC,EAAYC,EAAA,2BACvB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,UAkGQA,KAAAC,cAAgB,K,0FA3CS,E,UAaN,Q,UAaG,S,sBAQM,M,aAGF,G,sCAEF,M,qBACGC,MAAMC,KAAKC,IAAI,4B,wBACZF,MAAMC,KAAKC,IAAI,2BA/FnDJ,KAAKK,OAASL,KAAKK,OACnBH,MAAMI,SAAQ,WACZP,EAAKE,cAAgBC,MAAMK,IAAIH,IAAI,gBACnCL,EAAKS,MAAQN,MAAMO,OAAOL,IAAI,eAAgB,K,IAGhDF,MAAMC,KAAKO,UAAS,WAClBX,EAAKY,gBAAkBT,MAAMC,KAAKC,IAAI,4BACtCL,EAAKa,mBAAqBV,MAAMC,KAAKC,IAAI,0B,IA2F7CP,EAAAgB,UAAAC,aAAA,WACE,GAAId,KAAKK,SAAW,OAAQ,CAC1B,OAAOU,QAAQC,QAAQC,KAAKC,MAAMlB,KAAKmB,a,CAEzC,IAAMC,EAAgB,CAAC,WAAY,cAAcC,SAASrB,KAAKK,QAC/D,IAAMiB,EAAS,CACbC,MAAOvB,KAAKuB,MACZlB,OAAQL,KAAKK,OACbmB,MAAOJ,EAAgBH,KAAKC,MAAMlB,KAAKmB,aAAyBnB,KAAKmB,YACrEM,KAAMzB,KAAKyB,KACXC,KAAM1B,KAAK0B,KACXC,mBAAoB3B,KAAK4B,iBAAiB,EAAE,GAE9C,OAAO1B,MAAM2B,IAAIC,QAAQ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