@salla.sa/twilight-components 2.13.88 → 2.13.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-c5340b59.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_48.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-booking-field_2.cjs.entry.js +1 -3
- package/dist/cjs/salla-booking-field_2.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-product-options.cjs.entry.js +2 -2
- package/dist/cjs/salla-product-options.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-booking-field/salla-booking-field.js +1 -4
- package/dist/collection/components/salla-booking-field/salla-booking-field.js.map +1 -1
- package/dist/collection/components/salla-product-options/salla-product-options.js +2 -2
- package/dist/collection/components/salla-product-options/salla-product-options.js.map +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +1 -1
- package/dist/collection/components/salla-products-slider/salla-products-slider.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-booking-field2.js +1 -4
- package/dist/components/salla-booking-field2.js.map +1 -1
- package/dist/components/salla-product-options.js +2 -2
- package/dist/components/salla-product-options.js.map +1 -1
- package/dist/components/salla-products-list2.js.map +1 -1
- package/dist/components/salla-products-slider.js.map +1 -1
- package/dist/components/salla-quick-buy2.js.map +1 -1
- package/dist/esm/app-globals-0280e1d0.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_48.entry.js.map +1 -1
- package/dist/esm/salla-booking-field_2.entry.js +1 -3
- package/dist/esm/salla-booking-field_2.entry.js.map +1 -1
- package/dist/esm/salla-product-options.entry.js +2 -2
- package/dist/esm/salla-product-options.entry.js.map +1 -1
- package/dist/esm/salla-products-slider.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/app-globals-0280e1d0.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_48.entry.js.map +1 -1
- package/dist/esm-es5/salla-booking-field_2.entry.js +1 -1
- package/dist/esm-es5/salla-booking-field_2.entry.js.map +1 -1
- package/dist/esm-es5/salla-product-options.entry.js +1 -1
- package/dist/esm-es5/salla-product-options.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/p-0b3b39fc.entry.js.map +1 -1
- package/dist/twilight/p-1ae3cce4.system.entry.js +5 -0
- package/dist/twilight/p-1ae3cce4.system.entry.js.map +1 -0
- package/dist/twilight/p-1f9a3721.system.entry.js +5 -0
- package/dist/twilight/p-1f9a3721.system.entry.js.map +1 -0
- package/dist/twilight/p-411485fc.entry.js.map +1 -1
- package/dist/twilight/p-4a9df09e.js.map +1 -1
- package/dist/twilight/p-4c2194e3.system.js.map +1 -1
- package/dist/twilight/p-4e795693.system.entry.js.map +1 -1
- package/dist/twilight/p-54e1a882.system.js +1 -1
- package/dist/twilight/p-54e1a882.system.js.map +1 -1
- package/dist/twilight/p-666cefe6.system.entry.js.map +1 -1
- package/dist/twilight/p-e057192c.entry.js +5 -0
- package/dist/twilight/p-e057192c.entry.js.map +1 -0
- package/dist/twilight/p-fc0f037b.entry.js +5 -0
- package/dist/twilight/p-fc0f037b.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/types/components/salla-booking-field/salla-booking-field.d.ts +0 -1
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +2 -2
- package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +2 -2
- package/dist/types/components.d.ts +4 -4
- package/package.json +5 -5
- package/dist/twilight/p-5ba21699.system.entry.js +0 -5
- package/dist/twilight/p-5ba21699.system.entry.js.map +0 -1
- package/dist/twilight/p-6cce417a.entry.js +0 -5
- package/dist/twilight/p-6cce417a.entry.js.map +0 -1
- package/dist/twilight/p-a642b326.system.entry.js +0 -5
- package/dist/twilight/p-a642b326.system.entry.js.map +0 -1
- package/dist/twilight/p-bd26e79e.entry.js +0 -5
- package/dist/twilight/p-bd26e79e.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-products-list2.js","mappings":";;;;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCUlB,iBAAiB;EAgI5B;;;;;;;;;;;oBAjE6C,KAAK;;gCAgBX,2BAA2B;;gBAqB1C,CAAC;;;;;2BAKU,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC;qBACpD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;0BAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC;uBAC3D,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;;;;;IAqBlD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;MACtE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;MAClE,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;KAC7E,CAAC,CAAA;GACH;EAED,iBAAiB;IACf,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,wBAAwB,EAAE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;GAC9E;;;;;EA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IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAC5C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;MAC5E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACnF;IACD,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAI,EAAE,CAAC;GACvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Method, Event, EventEmitter } from '@stencil/core';\nimport anime from 'animejs';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\nimport { ProductResponse } from '@salla.sa/twilight/types/api/product';\nimport { Product } from '@salla.sa/twilight/types/common';\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n /**\n * TODO:: order the logic like this:\n * Properties: List all @Prop decorated properties.\n * Element References: Include @Element decorated properties to reference host elements.\n * State Properties: Place @State decorated properties.\n * Internal/Private Properties: Declare any internal or private properties.\n * Event Emitters: Define @Event decorated properties for event emitters.\n * Constructor: If you have a constructor, it should come next.\n * Initial Lifecycle Methods, example `connectedCallback`\n * Public Methods: Place public methods next, including those decorated with @Method.\n * Private Methods: List private methods (custom logic)\n * Component Lifecycle Methods with the same order, last one is `disconnectedCallback()`: see https://stenciljs.com/docs/component-lifecycle\n */\n\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales' | 'wishlist';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({ mutable: true }) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Sorting the list of products\n */\n @Prop({ mutable: true }) sortBy?: string | 'ourSuggest' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop';\n\n /**\n * should listen to filters events `salla-filters::changed` and re-render\n */\n @Prop({ reflect: true, mutable: true }) filtersResults: boolean;\n\n /**\n * Horizontal cards\n */\n @Prop({ reflect: true }) horizontalCards: boolean\n\n /**\n * Row cards\n */\n @Prop({ reflect: true }) rowCards: boolean\n\n /**\n * Autoload next page when scroll\n */\n @Prop({ mutable: true }) autoload: boolean = false;\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n /**\n * Specifies additional data to be included in the product fetch response.\n * The value can be an array of strings or a JSON string.\n * \n * Example:\n * - As an array: includes=[\"options\", \"images\"]\n * - As a JSON string: includes='[\"options\", \"images\"]'\n * \n * The array or JSON string can include:\n * - \"options\": Include product options in the response.\n * - \"images\": Include product images in the response.\n */\n @Prop({mutable: true}) includes: string | string[];\n\n\n @Element() host: HTMLElement;\n\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string = salla.lang.get('pages.categories.no_products');\n @State() endOfText: string = salla.lang.get('common.elements.end_of_content');\n @State() failedLoadMore: string = salla.lang.get('common.elements.failed_to_load_more');\n @State() currentPage: any = salla.config.get('page');\n @State() currentCategoryIdFilter: any;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() parsedFilters: any;\n\n private status: HTMLDivElement;\n private btnLoader: HTMLElement;\n private loader: HTMLElement;\n private placeholderLoader: HTMLElement;\n private loadMoreWrapper: HTMLElement;\n private wrapper: HTMLElement;\n private infiniteScroll: any;\n private firstPageResponse: ProductResponse.lists;\n\n /**\n * Custom event fired when the the products fetched.\n */\n @Event() productsFetched: EventEmitter;\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n this.endOfText = salla.lang.get('common.elements.end_of_content');\n this.failedLoadMore = salla.lang.get('common.elements.failed_to_load_more');\n })\n }\n\n connectedCallback() {\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\n }\n\n /**\n * Set parsed filters data from URI\n * @param filters\n */\n @Method()\n async setFilters(filters) {\n if (!filters || JSON.stringify(filters) === JSON.stringify(this.parsedFilters)) {\n return;\n }\n window.scrollTo({ top: 0, behavior: 'smooth' });\n // Create a deep copy of the filters object to avoid mutating the original object\n this.parsedFilters = JSON.parse(JSON.stringify(filters));\n if (this.currentPage.slug == \"product.index\" && this.parsedFilters && this.parsedFilters.category_id) {\n this.currentCategoryIdFilter = [this.parsedFilters.category_id]\n }\n return this.reload();\n }\n\n /**\n * Reload the list of products (entire content of the component).\n */\n @Method()\n async reload() {\n !this.autoload && this.loadMoreWrapper && (this.loadMoreWrapper.style.display = 'none');\n this.hasInfiniteScroll && salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n // TODO: this is problematic in testing, for the time being it's been resolved like this\n this.wrapper.innerHTML = '';\n if (this.hasInfiniteScroll) {\n this.init();\n } else {\n this.getInitialData();\n }\n // Special case for the placeholder loader\n if (this.showPlaceholder) {\n this.showPlaceholder = false;\n this.placeholderLoader = document.createElement('div');\n this.placeholderLoader.classList.add('s-products-list-loading-wrapper');\n this.placeholderLoader.style.display = 'inherit';\n this.placeholderLoader.innerHTML = `<span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\"></span>`;\n this.host.insertAdjacentElement('afterend', this.placeholderLoader);\n }\n }\n\n private isFilterable() {\n return salla.config.get('store.settings.product.filters') && this.filtersResults;\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales', 'wishlist'].includes(this.getSource());\n }\n\n private animateItems() {\n anime({\n targets: 'salla-products-list salla-product-card',\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n })\n }\n\n private initBaseNextPageUrl(source: string) {\n\n this.nextPage = salla.url.api(`products?source=${source}`);\n if(!!this.includes && (this.includes as Array<string>).length > 0) {\n this.nextPage += `&includes[]=${(this.includes as Array<string>).join('&includes[]=')}`;\n }\n\n if (this.limit) {\n this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;\n }\n if (this.sortBy) {\n this.nextPage += `&sort=${this.sortBy}`;\n }\n // if (!this.isFilterable()) {\n // return this.nextPage;\n // }\n this.nextPage += '&filterable=1';\n for (const [key, value] of Object.entries(this.parsedFilters || {})) {\n if ([\"string\", \"number\"].includes(typeof value)) {\n // @ts-ignore\n this.nextPage += `&filters[${encodeURIComponent(key)}]=${encodeURIComponent(value)}`;\n } else if (Array.isArray(value)) {\n value.forEach(item => this.nextPage += `&filters[${encodeURIComponent(key)}][]=${encodeURIComponent(item)}`);\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${encodeURIComponent(key)}][${encodeURIComponent(k)}]=${encodeURIComponent(v)}`;\n }\n }\n }\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n this.initBaseNextPageUrl(source);\n if (this.isSourceWithoutValue()) {\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage += `&source_value=${this.getSourceValue()}`;\n return;\n }\n try {\n this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private loading(isLoading = true, isBtn = false) {\n if (!isLoading) {\n if (!this.autoload) {\n this.btnLoader && (this.btnLoader.style.display = 'none');\n }\n this.loader && (this.loader.style.display = 'none');\n } else {\n let currentLoader = isBtn && !this.autoload ? this.btnLoader : this.loader;\n currentLoader && (currentLoader.style.display = 'inherit');\n }\n }\n\n private getItemHTML(product) {\n //as a request they don't want to let the user to open the product details\n //todo:: find a better way to handle this request\n this.getSource() === 'landing-page' && (product.url = '');\n const customComponentTag = this.hasCustomComponent ? this.productCardComponent : 'salla-product-card';\n const productCard = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n\n productCard.product = product;\n\n this.applyLandingPageStyles(productCard);\n this.applyHorizontalCardStyles(productCard);\n\n return productCard;\n }\n\n private applyLandingPageStyles(productCard) {\n if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {\n productCard.toggleAttribute('hide-add-btn', true);\n productCard.classList.add('s-product-card-fit-height');\n }\n }\n\n private applyHorizontalCardStyles(productCard) {\n if (!this.horizontalCards) {\n return;\n }\n productCard.setAttribute('horizontal', true);\n if (!this.hasCustomComponent) {\n productCard.setAttribute('shadow-on-hover', true);\n }\n\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return this.currentCategoryIdFilter ? this.currentCategoryIdFilter : Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n private appendDataLayer(data: Product[]): void {\n if (typeof dataLayer !== 'object' || !Array.isArray(dataLayer)) {\n //todo:: check if we should define it here\n return;\n }\n dataLayer.push({\n \"event\": \"impressions\",\n \"ecommerce\": {\n \"currencyCode\": salla.config.currency().code,\n // \"event_id\":\"\", // todo\n \"impressions\": data.map((product, index) => {\n return {\n \"id\": product.id,\n \"name\": product.name,\n \"price\": product.price,\n \"brand\": product.brand?.name || '',\n \"quantity\": product.quantity,\n // \"variant\": \"\",\n \"categories\": [\n {\n \"name\": product.category?.name || salla.config.get('page.title'),\n \"id\": salla.config.get('page.id')\n }\n ],\n \"category\": product.category?.name || salla.config.get('page.title'),\n 'position': index + 1\n }\n })\n }\n });\n }\n\n private updateProductOptions(productList, productOptions) {\n const productOptionsMap = new Map(productOptions.map(item => [item.id, item.options]));\n for (const product of productList) {\n product.options = productOptionsMap.get(product.id);\n }\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: this.autoload ? 100 : false,\n loadOnScroll: this.autoload,\n }, /* infinite via api*/true);\n this.infiniteScroll?.on('request', () => {\n this.loading(true, this.autoload ? false : true);\n })\n this.infiniteScroll?.on('load', async (response) => {\n if (!response.data?.length && this.infiniteScroll.pageIndex == 2) {\n this.showPlaceholder = true;\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.loading(false);\n this.placeholderLoader && this.placeholderLoader.remove();\n return;\n } else {\n if (this.includes && this.includes.includes('options')) {\n const productIds = response.data.map(product => product.id);\n const productOptions = await salla.api.product.fetchOptions(productIds);\n this.updateProductOptions(response.data, productOptions.data);\n }\n this.showPlaceholder = false;\n\n }\n this.infiniteScroll.appendItems(this.handleResponse(response))\n if (this.infiniteScroll.pageIndex == 2) {\n if (!this.autoload && this.nextPage) {\n this.loadMoreWrapper.style.display = 'block';\n }\n this.animateItems();\n }\n })\n this.infiniteScroll?.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.placeholderLoader && this.placeholderLoader.remove();\n this.loading(false);\n });\n salla.onReady(() => salla.infiniteScroll.loadNextPage(this.infiniteScroll))\n }\n\n private getInitialData() {\n this.loading();\n return salla.product.api.fetch({ source: this.getSource(), source_value: this.getSourceValue(), limit: this.limit, includes: this.includes }).then((response: any) => {\n if (!response.data.length) {\n this.showPlaceholder = true;\n this.placeholderLoader && this.placeholderLoader.remove();\n this.loading(false);\n return;\n }\n //this.firstPageResponse will be null only in the first page, after that it will be assinged,\n //for the first page we need to inject the dom after the load, see @method componentDidLoad\n if (!this.firstPageResponse) {\n this.firstPageResponse = response;\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n return\n }\n this.handleResponse(response).forEach(card => this.wrapper.append(card));\n });\n }\n\n async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n componentWillLoad() {\n return salla.onReady()\n .then(() => {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource()) && !this.limit;\n let searchParams = new URLSearchParams(window.location.search);\n\n this.includes = Helper.parseIncludesProp(this.includes)\n\n try {\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n\n this.parsedFilters = Helper.extractFiltersFromUrl(searchParams);\n\n if (this.parsedFilters && this.parsedFilters.category_id) {\n this.currentCategoryIdFilter = [this.parsedFilters.category_id];\n }\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n\n\n this.buildNextPageUrl();\n\n this.isReady = true;\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n\n if (this.hasInfiniteScroll) {\n return;\n }\n\n // Handle json source\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n //todo:: avoid using timeout, just assigne the data to the this.firstPageResponse and it should work fine, because it will be rendered in componentDidLoad\n setTimeout(() => {\n let productsList = this.getSourceValue()\n productsList.map(product => this.wrapper.append(this.getItemHTML(product)));\n });\n return;\n }\n\n // Handle selected source\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n\n return this.getInitialData();\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,\n 's-products-list-vertical-cards': !this.horizontalCards && !this.rowCards && !this.filtersResults,\n 's-products-list-row-cards': this.rowCards,\n 's-products-list-filters-results': this.filtersResults,\n }}\n ref={wrapper => this.wrapper = wrapper} />\n <div class=\"s-infinite-scroll-status\" ref={status => this.status = status}>\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >{this.endOfText}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">{this.failedLoadMore}</p>\n </div>\n\n <div class=\"s-products-list-loading-wrapper\" style={{ \"display\": \"none\" }} ref={loader => this.loader = loader}><span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\"></span></div>\n\n {this.hasInfiniteScroll && this.nextPage && !this.autoload ? (\n <div class=\"s-infinite-scroll-wrapper\" style={{ \"display\": \"none\" }} ref={loadMoreWrapper => this.loadMoreWrapper = loadMoreWrapper}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ? this.loadMoreText : salla.lang.get('common.elements.load_more')}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n ) : \"\"}\n </Host>\n );\n }\n\n componentDidLoad() {\n this.hasInfiniteScroll && this.init();\n //this method is runs only once, so we should be safe to render it without the need to set flag to check if it has rendered before or not;\n this.firstPageResponse && this.handleResponse(this.firstPageResponse, false).forEach(card => this.wrapper.append(card));\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n }\n\n private handleResponse(response, shouldBuildNextPage = true): Array<HTMLElement> {\n //todo:: check why it reach here undfined one time🤔\n if (!response) {\n return [];\n }\n let source = this.getSource();\n let title = '';\n //help the developer to know the current page title\n if (response.cursor?.current === 1) {\n title = Helper.getPageTitleForSource(source);\n try {\n if (this.getSource() === 'search') {\n title = salla.lang.get('common.elements.search_about', { 'word': this.getSourceValue() });\n } else if (!title) {\n let catId = this.parsedFilters.category_id || this.getSourceValue()[0];\n // get the first filter that its key is category_id, then get the value when filter.value.*.key==catId\n title = response.filters.find(filter => filter.key == 'category_id')?.values?.find(cat => cat.key == catId)?.value || '';\n }\n title += (title ? ' - ' : '') + salla.lang.choice('blocks.header.products_count', response.data?.length);\n if (response.data.length === 15) {\n title = title.replace(response.data.length, salla.lang.get('common.elements.more_than') + ' ' + response.data.length)\n }\n response.title = title;\n } catch (e) { }\n //inject the SEO schema\n //handleResponse works only on the infinite-scroll and infinite scroll works only on the categories pages and main latest-page ..etc, so no need to add condition\n Helper.generateProductSchema(response.data);\n }\n\n this.appendDataLayer(response.data);\n\n salla.event.emit('salla-products-list::products.fetched', response);\n this.productsFetched.emit(response);\n //💡 when source is related, cursor will not be existed\n if (response.filters && this.isFilterable()) {\n this.filtersResults = true;\n salla.event.emit('filters::fetched', { filters: response.filters });\n } else if (this.isFilterable()) {\n salla.event.emit('filters::hidden');\n }\n //because: this.nextPage is state we don't need to touch it after the build, to avoid the re-rendering\n if (shouldBuildNextPage) {\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n }\n this.loading(false);\n this.placeholderLoader && this.placeholderLoader.remove();\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"salla-products-list2.js","mappings":";;;;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCUlB,iBAAiB;EAgI5B;;;;;;;;;;;oBAjE6C,KAAK;;gCAgBX,2BAA2B;;gBAqB1C,CAAC;;;;;2BAKU,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC;qBACpD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;0BAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC;uBAC3D,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;;;;;IAqBlD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;MACtE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;MAClE,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;KAC7E,CAAC,CAAA;GACH;EAED,iBAAiB;IACf,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,wBAAwB,EAAE,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;GAC9E;;;;;EAOD,MAAM,UAAU,CAAC,OAAO;IACtB,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;MAC9E,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAA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,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACnF;IACD,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAI,EAAE,CAAC;GACvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Method, Event, EventEmitter } from '@stencil/core';\nimport anime from 'animejs';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\nimport { ProductResponse } from '@salla.sa/twilight/types/api/product';\nimport { Product } from '@salla.sa/twilight/types/common';\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n /**\n * TODO:: order the logic like this:\n * Properties: List all @Prop decorated properties.\n * Element References: Include @Element decorated properties to reference host elements.\n * State Properties: Place @State decorated properties.\n * Internal/Private Properties: Declare any internal or private properties.\n * Event Emitters: Define @Event decorated properties for event emitters.\n * Constructor: If you have a constructor, it should come next.\n * Initial Lifecycle Methods, example `connectedCallback`\n * Public Methods: Place public methods next, including those decorated with @Method.\n * Private Methods: List private methods (custom logic)\n * Component Lifecycle Methods with the same order, last one is `disconnectedCallback()`: see https://stenciljs.com/docs/component-lifecycle\n */\n\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales' | 'wishlist';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({ mutable: true }) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Sorting the list of products\n */\n @Prop({ mutable: true }) sortBy?: string | 'ourSuggest' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop';\n\n /**\n * should listen to filters events `salla-filters::changed` and re-render\n */\n @Prop({ reflect: true, mutable: true }) filtersResults: boolean;\n\n /**\n * Horizontal cards\n */\n @Prop({ reflect: true }) horizontalCards: boolean\n\n /**\n * Row cards\n */\n @Prop({ reflect: true }) rowCards: boolean\n\n /**\n * Autoload next page when scroll\n */\n @Prop({ mutable: true }) autoload: boolean = false;\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n /**\n * Specifies additional data to be included in the product fetch response.\n * The value can be an array of strings or a JSON string.\n * \n * Example:\n * - As an array: includes=[\"options\"]\n * - As a JSON string: includes='[\"options\"]'\n * \n * The array or JSON string can include:\n * - \"options\": Include product options in the response.\n * - \"images\": Include product images in the response.\n */\n @Prop({mutable: true}) includes: string | string[];\n\n\n @Element() host: HTMLElement;\n\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string = salla.lang.get('pages.categories.no_products');\n @State() endOfText: string = salla.lang.get('common.elements.end_of_content');\n @State() failedLoadMore: string = salla.lang.get('common.elements.failed_to_load_more');\n @State() currentPage: any = salla.config.get('page');\n @State() currentCategoryIdFilter: any;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() parsedFilters: any;\n\n private status: HTMLDivElement;\n private btnLoader: HTMLElement;\n private loader: HTMLElement;\n private placeholderLoader: HTMLElement;\n private loadMoreWrapper: HTMLElement;\n private wrapper: HTMLElement;\n private infiniteScroll: any;\n private firstPageResponse: ProductResponse.lists;\n\n /**\n * Custom event fired when the the products fetched.\n */\n @Event() productsFetched: EventEmitter;\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n this.endOfText = salla.lang.get('common.elements.end_of_content');\n this.failedLoadMore = salla.lang.get('common.elements.failed_to_load_more');\n })\n }\n\n connectedCallback() {\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\n }\n\n /**\n * Set parsed filters data from URI\n * @param filters\n */\n @Method()\n async setFilters(filters) {\n if (!filters || JSON.stringify(filters) === JSON.stringify(this.parsedFilters)) {\n return;\n }\n window.scrollTo({ top: 0, behavior: 'smooth' });\n // Create a deep copy of the filters object to avoid mutating the original object\n this.parsedFilters = JSON.parse(JSON.stringify(filters));\n if (this.currentPage.slug == \"product.index\" && this.parsedFilters && this.parsedFilters.category_id) {\n this.currentCategoryIdFilter = [this.parsedFilters.category_id]\n }\n return this.reload();\n }\n\n /**\n * Reload the list of products (entire content of the component).\n */\n @Method()\n async reload() {\n !this.autoload && this.loadMoreWrapper && (this.loadMoreWrapper.style.display = 'none');\n this.hasInfiniteScroll && salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n // TODO: this is problematic in testing, for the time being it's been resolved like this\n this.wrapper.innerHTML = '';\n if (this.hasInfiniteScroll) {\n this.init();\n } else {\n this.getInitialData();\n }\n // Special case for the placeholder loader\n if (this.showPlaceholder) {\n this.showPlaceholder = false;\n this.placeholderLoader = document.createElement('div');\n this.placeholderLoader.classList.add('s-products-list-loading-wrapper');\n this.placeholderLoader.style.display = 'inherit';\n this.placeholderLoader.innerHTML = `<span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\"></span>`;\n this.host.insertAdjacentElement('afterend', this.placeholderLoader);\n }\n }\n\n private isFilterable() {\n return salla.config.get('store.settings.product.filters') && this.filtersResults;\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales', 'wishlist'].includes(this.getSource());\n }\n\n private animateItems() {\n anime({\n targets: 'salla-products-list salla-product-card',\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n })\n }\n\n private initBaseNextPageUrl(source: string) {\n\n this.nextPage = salla.url.api(`products?source=${source}`);\n if(!!this.includes && (this.includes as Array<string>).length > 0) {\n this.nextPage += `&includes[]=${(this.includes as Array<string>).join('&includes[]=')}`;\n }\n\n if (this.limit) {\n this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;\n }\n if (this.sortBy) {\n this.nextPage += `&sort=${this.sortBy}`;\n }\n // if (!this.isFilterable()) {\n // return this.nextPage;\n // }\n this.nextPage += '&filterable=1';\n for (const [key, value] of Object.entries(this.parsedFilters || {})) {\n if ([\"string\", \"number\"].includes(typeof value)) {\n // @ts-ignore\n this.nextPage += `&filters[${encodeURIComponent(key)}]=${encodeURIComponent(value)}`;\n } else if (Array.isArray(value)) {\n value.forEach(item => this.nextPage += `&filters[${encodeURIComponent(key)}][]=${encodeURIComponent(item)}`);\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${encodeURIComponent(key)}][${encodeURIComponent(k)}]=${encodeURIComponent(v)}`;\n }\n }\n }\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n this.initBaseNextPageUrl(source);\n if (this.isSourceWithoutValue()) {\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage += `&source_value=${this.getSourceValue()}`;\n return;\n }\n try {\n this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private loading(isLoading = true, isBtn = false) {\n if (!isLoading) {\n if (!this.autoload) {\n this.btnLoader && (this.btnLoader.style.display = 'none');\n }\n this.loader && (this.loader.style.display = 'none');\n } else {\n let currentLoader = isBtn && !this.autoload ? this.btnLoader : this.loader;\n currentLoader && (currentLoader.style.display = 'inherit');\n }\n }\n\n private getItemHTML(product) {\n //as a request they don't want to let the user to open the product details\n //todo:: find a better way to handle this request\n this.getSource() === 'landing-page' && (product.url = '');\n const customComponentTag = this.hasCustomComponent ? this.productCardComponent : 'salla-product-card';\n const productCard = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n\n productCard.product = product;\n\n this.applyLandingPageStyles(productCard);\n this.applyHorizontalCardStyles(productCard);\n\n return productCard;\n }\n\n private applyLandingPageStyles(productCard) {\n if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {\n productCard.toggleAttribute('hide-add-btn', true);\n productCard.classList.add('s-product-card-fit-height');\n }\n }\n\n private applyHorizontalCardStyles(productCard) {\n if (!this.horizontalCards) {\n return;\n }\n productCard.setAttribute('horizontal', true);\n if (!this.hasCustomComponent) {\n productCard.setAttribute('shadow-on-hover', true);\n }\n\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return this.currentCategoryIdFilter ? this.currentCategoryIdFilter : Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n private appendDataLayer(data: Product[]): void {\n if (typeof dataLayer !== 'object' || !Array.isArray(dataLayer)) {\n //todo:: check if we should define it here\n return;\n }\n dataLayer.push({\n \"event\": \"impressions\",\n \"ecommerce\": {\n \"currencyCode\": salla.config.currency().code,\n // \"event_id\":\"\", // todo\n \"impressions\": data.map((product, index) => {\n return {\n \"id\": product.id,\n \"name\": product.name,\n \"price\": product.price,\n \"brand\": product.brand?.name || '',\n \"quantity\": product.quantity,\n // \"variant\": \"\",\n \"categories\": [\n {\n \"name\": product.category?.name || salla.config.get('page.title'),\n \"id\": salla.config.get('page.id')\n }\n ],\n \"category\": product.category?.name || salla.config.get('page.title'),\n 'position': index + 1\n }\n })\n }\n });\n }\n\n private updateProductOptions(productList, productOptions) {\n const productOptionsMap = new Map(productOptions.map(item => [item.id, item.options]));\n for (const product of productList) {\n product.options = productOptionsMap.get(product.id);\n }\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: this.autoload ? 100 : false,\n loadOnScroll: this.autoload,\n }, /* infinite via api*/true);\n this.infiniteScroll?.on('request', () => {\n this.loading(true, this.autoload ? false : true);\n })\n this.infiniteScroll?.on('load', async (response) => {\n if (!response.data?.length && this.infiniteScroll.pageIndex == 2) {\n this.showPlaceholder = true;\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.loading(false);\n this.placeholderLoader && this.placeholderLoader.remove();\n return;\n } else {\n if (this.includes && this.includes.includes('options')) {\n const productIds = response.data.map(product => product.id);\n const productOptions = await salla.api.product.fetchOptions(productIds);\n this.updateProductOptions(response.data, productOptions.data);\n }\n this.showPlaceholder = false;\n\n }\n this.infiniteScroll.appendItems(this.handleResponse(response))\n if (this.infiniteScroll.pageIndex == 2) {\n if (!this.autoload && this.nextPage) {\n this.loadMoreWrapper.style.display = 'block';\n }\n this.animateItems();\n }\n })\n this.infiniteScroll?.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.placeholderLoader && this.placeholderLoader.remove();\n this.loading(false);\n });\n salla.onReady(() => salla.infiniteScroll.loadNextPage(this.infiniteScroll))\n }\n\n private getInitialData() {\n this.loading();\n return salla.product.api.fetch({ source: this.getSource(), source_value: this.getSourceValue(), limit: this.limit, includes: this.includes }).then((response: any) => {\n if (!response.data.length) {\n this.showPlaceholder = true;\n this.placeholderLoader && this.placeholderLoader.remove();\n this.loading(false);\n return;\n }\n //this.firstPageResponse will be null only in the first page, after that it will be assinged,\n //for the first page we need to inject the dom after the load, see @method componentDidLoad\n if (!this.firstPageResponse) {\n this.firstPageResponse = response;\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n return\n }\n this.handleResponse(response).forEach(card => this.wrapper.append(card));\n });\n }\n\n async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n componentWillLoad() {\n return salla.onReady()\n .then(() => {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource()) && !this.limit;\n let searchParams = new URLSearchParams(window.location.search);\n\n this.includes = Helper.parseIncludesProp(this.includes)\n\n try {\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n\n this.parsedFilters = Helper.extractFiltersFromUrl(searchParams);\n\n if (this.parsedFilters && this.parsedFilters.category_id) {\n this.currentCategoryIdFilter = [this.parsedFilters.category_id];\n }\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n\n\n this.buildNextPageUrl();\n\n this.isReady = true;\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n\n if (this.hasInfiniteScroll) {\n return;\n }\n\n // Handle json source\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n //todo:: avoid using timeout, just assigne the data to the this.firstPageResponse and it should work fine, because it will be rendered in componentDidLoad\n setTimeout(() => {\n let productsList = this.getSourceValue()\n productsList.map(product => this.wrapper.append(this.getItemHTML(product)));\n });\n return;\n }\n\n // Handle selected source\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n\n return this.getInitialData();\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,\n 's-products-list-vertical-cards': !this.horizontalCards && !this.rowCards && !this.filtersResults,\n 's-products-list-row-cards': this.rowCards,\n 's-products-list-filters-results': this.filtersResults,\n }}\n ref={wrapper => this.wrapper = wrapper} />\n <div class=\"s-infinite-scroll-status\" ref={status => this.status = status}>\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >{this.endOfText}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">{this.failedLoadMore}</p>\n </div>\n\n <div class=\"s-products-list-loading-wrapper\" style={{ \"display\": \"none\" }} ref={loader => this.loader = loader}><span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\"></span></div>\n\n {this.hasInfiniteScroll && this.nextPage && !this.autoload ? (\n <div class=\"s-infinite-scroll-wrapper\" style={{ \"display\": \"none\" }} ref={loadMoreWrapper => this.loadMoreWrapper = loadMoreWrapper}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ? this.loadMoreText : salla.lang.get('common.elements.load_more')}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n ) : \"\"}\n </Host>\n );\n }\n\n componentDidLoad() {\n this.hasInfiniteScroll && this.init();\n //this method is runs only once, so we should be safe to render it without the need to set flag to check if it has rendered before or not;\n this.firstPageResponse && this.handleResponse(this.firstPageResponse, false).forEach(card => this.wrapper.append(card));\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n }\n\n private handleResponse(response, shouldBuildNextPage = true): Array<HTMLElement> {\n //todo:: check why it reach here undfined one time🤔\n if (!response) {\n return [];\n }\n let source = this.getSource();\n let title = '';\n //help the developer to know the current page title\n if (response.cursor?.current === 1) {\n title = Helper.getPageTitleForSource(source);\n try {\n if (this.getSource() === 'search') {\n title = salla.lang.get('common.elements.search_about', { 'word': this.getSourceValue() });\n } else if (!title) {\n let catId = this.parsedFilters.category_id || this.getSourceValue()[0];\n // get the first filter that its key is category_id, then get the value when filter.value.*.key==catId\n title = response.filters.find(filter => filter.key == 'category_id')?.values?.find(cat => cat.key == catId)?.value || '';\n }\n title += (title ? ' - ' : '') + salla.lang.choice('blocks.header.products_count', response.data?.length);\n if (response.data.length === 15) {\n title = title.replace(response.data.length, salla.lang.get('common.elements.more_than') + ' ' + response.data.length)\n }\n response.title = title;\n } catch (e) { }\n //inject the SEO schema\n //handleResponse works only on the infinite-scroll and infinite scroll works only on the categories pages and main latest-page ..etc, so no need to add condition\n Helper.generateProductSchema(response.data);\n }\n\n this.appendDataLayer(response.data);\n\n salla.event.emit('salla-products-list::products.fetched', response);\n this.productsFetched.emit(response);\n //💡 when source is related, cursor will not be existed\n if (response.filters && this.isFilterable()) {\n this.filtersResults = true;\n salla.event.emit('filters::fetched', { filters: response.filters });\n } else if (this.isFilterable()) {\n salla.event.emit('filters::hidden');\n }\n //because: this.nextPage is state we don't need to touch it after the build, to avoid the re-rendering\n if (shouldBuildNextPage) {\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n }\n this.loading(false);\n this.placeholderLoader && this.placeholderLoader.remove();\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-products-slider.js","mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,sBAAsB,GAAG,EAAE;;MCQpBA,qBAAm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I,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,IAE1D,WAAK,IAAI,EAAC,OAAO,IACd,MAAA,IAAI,CAAC,YAAY,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CACzD,CACO,CACV,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductsSlider"],"sources":["src/components/salla-products-slider/salla-products-slider.scss?tag=salla-products-slider","src/components/salla-products-slider/salla-products-slider.tsx"],"sourcesContent":[".s-products-slider{\n &-wrapper{\n\n }\n &-slider{\n\n }\n &-card{\n\n }\n}","import { Component, Host, h, Prop, Element, State } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-products-slider',\n styleUrl: 'salla-products-slider.scss'\n})\n\n//todo:: extends this component from salla-products-list or the opposite\nexport class SallaProductsSlider {\n /**\n * Title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() blockTitle: string;\n\n /**\n * Sub title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() subTitle: string;\n\n /**\n * Slider Id, if not provided will be generated automatically\n * @type {string}\n * @default ''\n * */\n @Prop() sliderId: string;\n\n /**\n * Display 'ALL' URL\n * @type {string}\n * @default ''\n * */\n @Prop() displayAllUrl: string;\n\n /**\n * autoplay option for products slider\n */\n @Prop({ mutable: true }) autoplay: boolean\n\n /**\n * Source of the products, if api will get the products from the API, if json will get the products from the products prop\n * @type {string}\n * @default ''\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'wishlist';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop() sourceValue: string;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Slider Configs refer to https://swiperjs.com/swiper-api#parameters and pass the entire config object\n * @example\n * let slider = document.querySelector('salla-slider');\n * slider.sliderConfig = {\n * slidesPerView: 1,\n * spaceBetween : 30,\n * lazy: true,\n * }\n *\n */\n @Prop({ reflect: true }) sliderConfig: any;\n\n /**\n * Custom Card Component for the Salla Products Slider.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products Slider.\n *\n * @example\n * <salla-products-slider product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-slider product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n /**\n * Specifies additional data to be included in the product fetch response.\n * The value can be an array of strings or a JSON string.\n * \n * Example:\n * - As an array: includes=[\"options\", \"images\"]\n * - As a JSON string: includes='[\"options\", \"images\"]'\n * \n * The array or JSON string can include:\n * - \"options\": Include product options in the response.\n * - \"images\": Include product images in the response.\n */\n @Prop({mutable: true}) includes: string | string[];\n\n\n @Element() host: HTMLElement;\n //todo:: support limit, default =10, make sure that maximum is 32,\n\n\n @State() productsData: any;\n @State() isReady: boolean;\n @State() sourceValueIsValid: boolean;\n @State() hasCustomComponent: boolean;\n @State() apiUrl: string = '';\n @State() parsedSourceValue: any;\n\n componentWillLoad() {\n return salla.onReady()\n .then(() => {\n this.includes = Helper.parseIncludesProp(this.includes)\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()\n }]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n\n if (this.source === 'json') {\n this.productsData = this.getSourceValue();\n this.isReady = true\n return;\n }\n\n if ((this.getSource() == 'related' && !salla.config.get('store.settings.product.related_products_enabled'))) {\n this.isReady = false\n return;\n }\n\n return salla.product.api.fetch({ source: this.getSource(), source_value: this.getSourceValue(), limit: this.limit, includes: this.includes }).then(response => {\n this.productsData = response.data\n this.isReady = true\n salla.event.emit('salla-products-slider::products.fetched', response.data);\n });\n });\n }\n componentDidRender() {\n let processedCount = 0;\n const intervalId = setInterval(() => {\n this.host.querySelectorAll('[loading=\"lazy\"]')?.forEach(img => img.removeAttribute('loading'));\n processedCount++;\n if (processedCount >= 10) {\n clearInterval(intervalId);\n }\n }, 1000);\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private getItemHTML(product) {\n\n //as a request they don't want to let the user to open the product details\n //todo:: find a better way to handle this request\n this.getSource() === 'landing-page' && (product.url = '');\n if (this.hasCustomComponent && this.productCardComponent.toLowerCase() == 'custom-salla-product-card') {\n return <div class=\"s-products-slider-card\">\n <custom-salla-product-card product={product} source={this.getSource()} source-value={this.getSourceValue()} />\n </div>\n }\n\n if (this.hasCustomComponent) {\n const customElem = document.createElement(this.productCardComponent);\n customElem.setAttribute('product', JSON.stringify(product));\n customElem.setAttribute('source', this.getSource());\n customElem.setAttribute('source-value', this.getSourceValue());\n\n return <div class=\"s-products-slider-card\" innerHTML={customElem.outerHTML} />;\n }\n\n return <div class=\"s-products-slider-card\">\n <salla-product-card\n show-quantity={this.getSource() == 'landing-page'}\n hide-add-btn={this.getSource() == 'landing-page'}\n shadow-on-hover={true}\n product={product} />\n </div>;\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n render() {\n if (!this.canRender()) {\n return;\n }\n return (\n <Host class=\"s-products-slider-wrapper\">\n <salla-slider\n class=\"s-products-slider-slider\"\n id={this.sliderId || `s-products-slider-${Math.random().toString(36).substr(2, 9)}`}\n auto-play={this.autoplay}\n type=\"carousel\"\n block-title={this.blockTitle}\n block-subTitle={this.subTitle}\n display-all-url={this.displayAllUrl}\n sliderConfig={this.sliderConfig ? this.sliderConfig : null}\n >\n <div slot=\"items\">\n {this.productsData?.map(product => this.getItemHTML(product))}\n </div>\n </salla-slider>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
1
|
+
{"file":"salla-products-slider.js","mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,sBAAsB,GAAG,EAAE;;MCQpBA,qBAAmB;;;;;;;;;;;;;gCAiFS,2BAA2B;;;;;;kBAyBxC,EAAE;;;EAG5B,iBAAiB;IACf,OAAO,KAAK,CAAC,OAAO,EAAE;OACrB,IAAI,CAAC;MACJ,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;MACvD,IAAI,CAAC,kBAAkB,GAAG,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;MACnF,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;QAC5B,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,6CAA6C,IAAI,CAAC,SAAS,EAC3E,GAAG,CAAC,CAAC;QACP,OAAO;OACR;MACD,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;MAE1E,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;QAC1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,OAAO;OACR;MAED,KAAK,IAAI,CAAC,SAAS,EAAE,IAAI,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,iDAAiD,CAAC,GAAG;QAC3G,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,OAAO;OACR;MAED,OAAO,KAAK,CAAC,OAAO,CAAC,G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,IAAI,qBAAqB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,eACxE,IAAI,CAAC,QAAQ,EACxB,IAAI,EAAC,UAAU,iBACF,IAAI,CAAC,UAAU,oBACZ,IAAI,CAAC,QAAQ,qBACZ,IAAI,CAAC,aAAa,EACnC,YAAY,EAAE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,IAE1D,WAAK,IAAI,EAAC,OAAO,IACd,MAAA,IAAI,CAAC,YAAY,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CACzD,CACO,CACV,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductsSlider"],"sources":["src/components/salla-products-slider/salla-products-slider.scss?tag=salla-products-slider","src/components/salla-products-slider/salla-products-slider.tsx"],"sourcesContent":[".s-products-slider{\n &-wrapper{\n\n }\n &-slider{\n\n }\n &-card{\n\n }\n}","import { Component, Host, h, Prop, Element, State } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-products-slider',\n styleUrl: 'salla-products-slider.scss'\n})\n\n//todo:: extends this component from salla-products-list or the opposite\nexport class SallaProductsSlider {\n /**\n * Title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() blockTitle: string;\n\n /**\n * Sub title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() subTitle: string;\n\n /**\n * Slider Id, if not provided will be generated automatically\n * @type {string}\n * @default ''\n * */\n @Prop() sliderId: string;\n\n /**\n * Display 'ALL' URL\n * @type {string}\n * @default ''\n * */\n @Prop() displayAllUrl: string;\n\n /**\n * autoplay option for products slider\n */\n @Prop({ mutable: true }) autoplay: boolean\n\n /**\n * Source of the products, if api will get the products from the API, if json will get the products from the products prop\n * @type {string}\n * @default ''\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'wishlist';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop() sourceValue: string;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Slider Configs refer to https://swiperjs.com/swiper-api#parameters and pass the entire config object\n * @example\n * let slider = document.querySelector('salla-slider');\n * slider.sliderConfig = {\n * slidesPerView: 1,\n * spaceBetween : 30,\n * lazy: true,\n * }\n *\n */\n @Prop({ reflect: true }) sliderConfig: any;\n\n /**\n * Custom Card Component for the Salla Products Slider.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products Slider.\n *\n * @example\n * <salla-products-slider product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-slider product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n /**\n * Specifies additional data to be included in the product fetch response.\n * The value can be an array of strings or a JSON string.\n * \n * Example:\n * - As an array: includes=[\"options\"]\n * - As a JSON string: includes='[\"options\"]'\n * \n * The array or JSON string can include:\n * - \"options\": Include product options in the response.\n * - \"images\": Include product images in the response.\n */\n @Prop({mutable: true}) includes: string | string[];\n\n\n @Element() host: HTMLElement;\n //todo:: support limit, default =10, make sure that maximum is 32,\n\n\n @State() productsData: any;\n @State() isReady: boolean;\n @State() sourceValueIsValid: boolean;\n @State() hasCustomComponent: boolean;\n @State() apiUrl: string = '';\n @State() parsedSourceValue: any;\n\n componentWillLoad() {\n return salla.onReady()\n .then(() => {\n this.includes = Helper.parseIncludesProp(this.includes)\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()\n }]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n\n if (this.source === 'json') {\n this.productsData = this.getSourceValue();\n this.isReady = true\n return;\n }\n\n if ((this.getSource() == 'related' && !salla.config.get('store.settings.product.related_products_enabled'))) {\n this.isReady = false\n return;\n }\n\n return salla.product.api.fetch({ source: this.getSource(), source_value: this.getSourceValue(), limit: this.limit, includes: this.includes }).then(response => {\n this.productsData = response.data\n this.isReady = true\n salla.event.emit('salla-products-slider::products.fetched', response.data);\n });\n });\n }\n componentDidRender() {\n let processedCount = 0;\n const intervalId = setInterval(() => {\n this.host.querySelectorAll('[loading=\"lazy\"]')?.forEach(img => img.removeAttribute('loading'));\n processedCount++;\n if (processedCount >= 10) {\n clearInterval(intervalId);\n }\n }, 1000);\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private getItemHTML(product) {\n\n //as a request they don't want to let the user to open the product details\n //todo:: find a better way to handle this request\n this.getSource() === 'landing-page' && (product.url = '');\n if (this.hasCustomComponent && this.productCardComponent.toLowerCase() == 'custom-salla-product-card') {\n return <div class=\"s-products-slider-card\">\n <custom-salla-product-card product={product} source={this.getSource()} source-value={this.getSourceValue()} />\n </div>\n }\n\n if (this.hasCustomComponent) {\n const customElem = document.createElement(this.productCardComponent);\n customElem.setAttribute('product', JSON.stringify(product));\n customElem.setAttribute('source', this.getSource());\n customElem.setAttribute('source-value', this.getSourceValue());\n\n return <div class=\"s-products-slider-card\" innerHTML={customElem.outerHTML} />;\n }\n\n return <div class=\"s-products-slider-card\">\n <salla-product-card\n show-quantity={this.getSource() == 'landing-page'}\n hide-add-btn={this.getSource() == 'landing-page'}\n shadow-on-hover={true}\n product={product} />\n </div>;\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n render() {\n if (!this.canRender()) {\n return;\n }\n return (\n <Host class=\"s-products-slider-wrapper\">\n <salla-slider\n class=\"s-products-slider-slider\"\n id={this.sliderId || `s-products-slider-${Math.random().toString(36).substr(2, 9)}`}\n auto-play={this.autoplay}\n type=\"carousel\"\n block-title={this.blockTitle}\n block-subTitle={this.subTitle}\n display-all-url={this.displayAllUrl}\n sliderConfig={this.sliderConfig ? this.sliderConfig : null}\n >\n <div slot=\"items\">\n {this.productsData?.map(product => this.getItemHTML(product))}\n </div>\n </salla-slider>\n </Host>\n );\n }\n\n}\n"],"version":3}
|