@salla.sa/twilight-components 2.12.71 → 2.12.72

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 (70) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-filters-widget.cjs.entry.js +12 -8
  3. package/dist/cjs/salla-filters-widget.cjs.entry.js.map +1 -1
  4. package/dist/cjs/salla-price-range.cjs.entry.js +28 -15
  5. package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
  6. package/dist/cjs/salla-products-list.cjs.entry.js +54 -27
  7. package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
  8. package/dist/cjs/twilight.cjs.js +1 -1
  9. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +12 -8
  10. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js.map +1 -1
  11. package/dist/collection/components/salla-price-range/salla-price-range.js +31 -16
  12. package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
  13. package/dist/collection/components/salla-products-list/salla-products-list.js +91 -27
  14. package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
  15. package/dist/components/salla-filters-widget2.js +12 -8
  16. package/dist/components/salla-filters-widget2.js.map +1 -1
  17. package/dist/components/salla-price-range2.js +30 -15
  18. package/dist/components/salla-price-range2.js.map +1 -1
  19. package/dist/components/salla-products-list.js +58 -27
  20. package/dist/components/salla-products-list.js.map +1 -1
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/salla-filters-widget.entry.js +12 -8
  23. package/dist/esm/salla-filters-widget.entry.js.map +1 -1
  24. package/dist/esm/salla-price-range.entry.js +28 -15
  25. package/dist/esm/salla-price-range.entry.js.map +1 -1
  26. package/dist/esm/salla-products-list.entry.js +54 -27
  27. package/dist/esm/salla-products-list.entry.js.map +1 -1
  28. package/dist/esm/twilight.js +1 -1
  29. package/dist/esm-es5/loader.js +1 -1
  30. package/dist/esm-es5/loader.js.map +1 -1
  31. package/dist/esm-es5/salla-filters-widget.entry.js +2 -2
  32. package/dist/esm-es5/salla-filters-widget.entry.js.map +1 -1
  33. package/dist/esm-es5/salla-price-range.entry.js +2 -2
  34. package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
  35. package/dist/esm-es5/salla-products-list.entry.js +2 -2
  36. package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
  37. package/dist/esm-es5/twilight.js +1 -1
  38. package/dist/esm-es5/twilight.js.map +1 -1
  39. package/dist/twilight/p-06d0f1fc.system.entry.js +5 -0
  40. package/dist/twilight/p-06d0f1fc.system.entry.js.map +1 -0
  41. package/dist/twilight/p-2059b78a.system.js +1 -1
  42. package/dist/twilight/p-2059b78a.system.js.map +1 -1
  43. package/dist/twilight/{p-2f8608f8.system.entry.js → p-65b34312.system.entry.js} +2 -2
  44. package/dist/twilight/p-65b34312.system.entry.js.map +1 -0
  45. package/dist/twilight/p-73543cab.entry.js +5 -0
  46. package/dist/twilight/p-73543cab.entry.js.map +1 -0
  47. package/dist/twilight/p-b095f117.system.entry.js +5 -0
  48. package/dist/twilight/p-b095f117.system.entry.js.map +1 -0
  49. package/dist/twilight/p-c868470b.entry.js +5 -0
  50. package/dist/twilight/p-c868470b.entry.js.map +1 -0
  51. package/dist/twilight/p-f5558708.entry.js +5 -0
  52. package/dist/twilight/p-f5558708.entry.js.map +1 -0
  53. package/dist/twilight/twilight.esm.js +1 -1
  54. package/dist/twilight/twilight.esm.js.map +1 -1
  55. package/dist/types/components/salla-filters-widget/salla-filters-widget.d.ts +1 -1
  56. package/dist/types/components/salla-price-range/salla-price-range.d.ts +2 -0
  57. package/dist/types/components/salla-products-list/salla-products-list.d.ts +14 -1
  58. package/dist/types/components.d.ts +16 -0
  59. package/package.json +5 -5
  60. package/dist/twilight/p-070d4e23.system.entry.js +0 -5
  61. package/dist/twilight/p-070d4e23.system.entry.js.map +0 -1
  62. package/dist/twilight/p-098528e4.entry.js +0 -5
  63. package/dist/twilight/p-098528e4.entry.js.map +0 -1
  64. package/dist/twilight/p-27fb76ab.entry.js +0 -5
  65. package/dist/twilight/p-27fb76ab.entry.js.map +0 -1
  66. package/dist/twilight/p-2f8608f8.system.entry.js.map +0 -1
  67. package/dist/twilight/p-52890817.entry.js +0 -5
  68. package/dist/twilight/p-52890817.entry.js.map +0 -1
  69. package/dist/twilight/p-c944174c.system.entry.js +0 -5
  70. package/dist/twilight/p-c944174c.system.entry.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{b as bootstrapLazy}from"./index-e6c3f002.js";export{s as setNonce}from"./index-e6c3f002.js";import{g as globalScripts}from"./app-globals-3843d7b4.js";import"./_commonjsHelpers-1415ffd3.js";var defineCustomElements=function(e,a){if(typeof window==="undefined")return undefined;globalScripts();return bootstrapLazy(JSON.parse('[["salla-products-slider",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"autoplay":[1028],"source":[1537],"sourceValue":[1,"source-value"],"limit":[1026],"sliderConfig":[520,"slider-config"],"productCardComponent":[1,"product-card-component"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["salla-product-options",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectDonationAmount":[32],"selectAmount":[32],"isCustomDonation":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["salla-filters",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["salla-notifications",[[0,"salla-notifications",{"loadMoreText":[1,"load-more-text"],"itemPerPage":[2,"item-per-page"],"notifications":[32],"pagination":[32],"hasInfiniteScroll":[32],"total":[32],"showPlaceholder":[32],"nextPage":[32],"no_notifications_trans":[32],"load_more_text_trans":[32]}]]],["salla-advertisement",[[0,"salla-advertisement",{"position":[32],"advertisements":[32],"advertIcon":[32],"currentSlug":[32]}]]],["salla-apps-icons",[[0,"salla-apps-icons",{"hideTitle":[4,"hide-title"],"appsTitle":[1,"apps-title"],"vertical":[4],"apps":[32]}]]],["salla-contacts",[[0,"salla-contacts",{"contactsTitle":[1,"contacts-title"],"hideTitle":[4,"hide-title"],"isHeader":[4,"is-header"],"horizontal":[4],"iconsOnly":[4,"icons-only"],"contacts":[32],"iconsList":[32]}]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-loyalty-prize-item",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["salla-payments",[[0,"salla-payments",{"withSbc":[4,"with-sbc"],"sbcId":[1,"sbc-id"],"withMadeInKsa":[4,"with-made-in-ksa"],"payments":[32],"placeholderImage":[32]}]]],["salla-products-list",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"sortBy":[1025,"sort-by"],"filtersResults":[1540,"filters-results"],"horizontalCards":[516,"horizontal-cards"],"productCardComponent":[1,"product-card-component"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"parsedFilters":[32],"setFilters":[64],"reload":[64]}]]],["salla-social",[[0,"salla-social",{"links":[32],"iconsList":[32]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-notification-item",[[0,"salla-notification-item",{"notification":[16]}]]],["salla-price-range",[[0,"salla-price-range",{"minPrice":[1032,"min-price"],"maxPrice":[1032,"max-price"],"option":[16],"filtersData":[520,"filters-data"],"min":[32],"max":[32],"priceOptions":[32],"moreThanLabel":[32],"lessThanLabel":[32],"toLabel":[32],"fromLabel":[32],"reset":[64]}]]],["salla-add-product-button_47",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetTitle":[1,"widget-title"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[0,"salla-menu",{"source":[1],"sourceValue":[1,"source-value"],"topnav":[4],"useReactLink":[4,"use-react-link"],"menus":[32],"hasCustomComponent":[32],"setMenuContent":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"inline":[516],"withoutReload":[4,"without-reload"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"currentPhone":[32],"currentEmail":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"hasError":[32],"errorMessage":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-bottom-alert",{"type":[513],"icon":[513],"message":[513],"actionUrl":[513,"action-url"],"actionLabel":[513,"action-label"],"storeId":[32],"template":[32],"loading":[32],"templateData":[32],"defaultMessage":[32],"defaultActionLabel":[32],"storeFeatures":[32],"storeDetails":[32],"storePrice":[32],"theDeveloper":[32],"templateInformation":[32],"buyTheTemplate":[32],"isRtl":[32]}],[0,"salla-comments",{"itemId":[2,"item-id"],"loadMoreText":[1,"load-more-text"],"hideForm":[4,"hide-form"],"type":[1],"comments":[32],"pagination":[32],"total":[32],"showPlaceholder":[32],"nextPage":[32],"noComments":[32],"comment_title":[32],"comment_name":[32],"placeholder_text":[32]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-profile",{"customFields":[1,"custom-fields"],"userData":[32],"userDefinedFields":[32],"disableAction":[32],"first_name_trans":[32],"last_name_trans":[32],"birthday_trans":[32],"birthday_placeholder_trans":[32],"gender_trans":[32],"gender_placeholder_trans":[32],"male_trans":[32],"female_trans":[32],"email_trans":[32],"mobile_trans":[32],"save_btn_trans":[32],"drag_and_drop_trans":[32],"browse_trans":[32],"email_required_trans":[32],"invalid_email_trans":[32],"setCustomFields":[64]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"maxWords":[2,"max-words"],"showAction":[4,"show-action"],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64],"refresh":[64]}],[0,"salla-breadcrumb",{"items":[1],"breadcrumbs":[32],"currentPage":[32],"isRtl":[32]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"loadMoreText":[1,"load-more-text"],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"cartItemId":[8,"cart-item-id"],"quantity":[32],"fireChangeEvent":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"hasError":[32],"errorMessage":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[0,"salla-comment-item",{"comment":[16],"has_bought_trans":[32],"rated_trans":[32],"waiting_approval_trans":[32],"has_order_trans":[32]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"cartId":[1025,"cart-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"applePayOnly":[1028,"apple-pay-only"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"windowWidth":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"type":[513],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-filters-widget",[[4,"salla-filters-widget",{"withLoadMore":[1028,"with-load-more"],"filtersData":[16],"option":[16],"isOpen":[32],"isShowMore":[32],"showMoreLabel":[32],"showLessLabel":[32],"page":[32],"setWidgetHeight":[64],"reset":[64],"showMore":[64],"toggleWidget":[64]}]]]]'),a)};export{defineCustomElements};
4
+ import{b as bootstrapLazy}from"./index-e6c3f002.js";export{s as setNonce}from"./index-e6c3f002.js";import{g as globalScripts}from"./app-globals-3843d7b4.js";import"./_commonjsHelpers-1415ffd3.js";var defineCustomElements=function(e,a){if(typeof window==="undefined")return undefined;globalScripts();return bootstrapLazy(JSON.parse('[["salla-products-slider",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"autoplay":[1028],"source":[1537],"sourceValue":[1,"source-value"],"limit":[1026],"sliderConfig":[520,"slider-config"],"productCardComponent":[1,"product-card-component"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["salla-product-options",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectDonationAmount":[32],"selectAmount":[32],"isCustomDonation":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["salla-filters",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["salla-notifications",[[0,"salla-notifications",{"loadMoreText":[1,"load-more-text"],"itemPerPage":[2,"item-per-page"],"notifications":[32],"pagination":[32],"hasInfiniteScroll":[32],"total":[32],"showPlaceholder":[32],"nextPage":[32],"no_notifications_trans":[32],"load_more_text_trans":[32]}]]],["salla-advertisement",[[0,"salla-advertisement",{"position":[32],"advertisements":[32],"advertIcon":[32],"currentSlug":[32]}]]],["salla-apps-icons",[[0,"salla-apps-icons",{"hideTitle":[4,"hide-title"],"appsTitle":[1,"apps-title"],"vertical":[4],"apps":[32]}]]],["salla-contacts",[[0,"salla-contacts",{"contactsTitle":[1,"contacts-title"],"hideTitle":[4,"hide-title"],"isHeader":[4,"is-header"],"horizontal":[4],"iconsOnly":[4,"icons-only"],"contacts":[32],"iconsList":[32]}]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-loyalty-prize-item",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["salla-payments",[[0,"salla-payments",{"withSbc":[4,"with-sbc"],"sbcId":[1,"sbc-id"],"withMadeInKsa":[4,"with-made-in-ksa"],"payments":[32],"placeholderImage":[32]}]]],["salla-products-list",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"sortBy":[1025,"sort-by"],"filtersResults":[1540,"filters-results"],"horizontalCards":[516,"horizontal-cards"],"autoload":[1028],"loadMoreText":[1,"load-more-text"],"productCardComponent":[1,"product-card-component"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"endOfText":[32],"failedLoadMore":[32],"isReady":[32],"showPlaceholder":[32],"parsedFilters":[32],"setFilters":[64],"reload":[64]}]]],["salla-social",[[0,"salla-social",{"links":[32],"iconsList":[32]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-notification-item",[[0,"salla-notification-item",{"notification":[16]}]]],["salla-price-range",[[0,"salla-price-range",{"minPrice":[1032,"min-price"],"maxPrice":[1032,"max-price"],"option":[16],"filtersData":[520,"filters-data"],"min":[32],"max":[32],"priceOptions":[32],"moreThanLabel":[32],"lessThanLabel":[32],"toLabel":[32],"fromLabel":[32],"typing":[32],"debounce":[32],"reset":[64]}]]],["salla-add-product-button_47",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetTitle":[1,"widget-title"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[0,"salla-menu",{"source":[1],"sourceValue":[1,"source-value"],"topnav":[4],"useReactLink":[4,"use-react-link"],"menus":[32],"hasCustomComponent":[32],"setMenuContent":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"inline":[516],"withoutReload":[4,"without-reload"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"currentPhone":[32],"currentEmail":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"hasError":[32],"errorMessage":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-bottom-alert",{"type":[513],"icon":[513],"message":[513],"actionUrl":[513,"action-url"],"actionLabel":[513,"action-label"],"storeId":[32],"template":[32],"loading":[32],"templateData":[32],"defaultMessage":[32],"defaultActionLabel":[32],"storeFeatures":[32],"storeDetails":[32],"storePrice":[32],"theDeveloper":[32],"templateInformation":[32],"buyTheTemplate":[32],"isRtl":[32]}],[0,"salla-comments",{"itemId":[2,"item-id"],"loadMoreText":[1,"load-more-text"],"hideForm":[4,"hide-form"],"type":[1],"comments":[32],"pagination":[32],"total":[32],"showPlaceholder":[32],"nextPage":[32],"noComments":[32],"comment_title":[32],"comment_name":[32],"placeholder_text":[32]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-profile",{"customFields":[1,"custom-fields"],"userData":[32],"userDefinedFields":[32],"disableAction":[32],"first_name_trans":[32],"last_name_trans":[32],"birthday_trans":[32],"birthday_placeholder_trans":[32],"gender_trans":[32],"gender_placeholder_trans":[32],"male_trans":[32],"female_trans":[32],"email_trans":[32],"mobile_trans":[32],"save_btn_trans":[32],"drag_and_drop_trans":[32],"browse_trans":[32],"email_required_trans":[32],"invalid_email_trans":[32],"setCustomFields":[64]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"maxWords":[2,"max-words"],"showAction":[4,"show-action"],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64],"refresh":[64]}],[0,"salla-breadcrumb",{"items":[1],"breadcrumbs":[32],"currentPage":[32],"isRtl":[32]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"loadMoreText":[1,"load-more-text"],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"cartItemId":[8,"cart-item-id"],"quantity":[32],"fireChangeEvent":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"hasError":[32],"errorMessage":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[0,"salla-comment-item",{"comment":[16],"has_bought_trans":[32],"rated_trans":[32],"waiting_approval_trans":[32],"has_order_trans":[32]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"cartId":[1025,"cart-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"applePayOnly":[1028,"apple-pay-only"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"windowWidth":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"type":[513],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-filters-widget",[[4,"salla-filters-widget",{"withLoadMore":[1028,"with-load-more"],"filtersData":[16],"option":[16],"isOpen":[32],"isShowMore":[32],"showMoreLabel":[32],"showLessLabel":[32],"page":[32],"setWidgetHeight":[64],"reset":[64],"showMore":[64],"toggleWidget":[64]}]]]]'),a)};export{defineCustomElements};
5
5
  //# sourceMappingURL=loader.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["defineCustomElements","win","options","window","undefined","globalScripts","bootstrapLazy","JSON","parse"],"sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = (win, options) => {\n if (typeof window === 'undefined') return undefined;\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"mappings":";;;oMAGY,IAACA,qBAAuB,SAACC,EAAKC,GACxC,UAAWC,SAAW,YAAa,OAAOC,UAC1CC,gBACA,OAAOC,cAAcC,KAAAC,MAAA,osmBAAuCN,EAC9D,S"}
1
+ {"version":3,"names":["defineCustomElements","win","options","window","undefined","globalScripts","bootstrapLazy","JSON","parse"],"sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = (win, options) => {\n if (typeof window === 'undefined') return undefined;\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"mappings":";;;oMAGY,IAACA,qBAAuB,SAACC,EAAKC,GACxC,UAAWC,SAAW,YAAa,OAAOC,UAC1CC,gBACA,OAAOC,cAAcC,KAAAC,MAAA,+zmBAAuCN,EAC9D,S"}
@@ -1,5 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n["throw"](t))}catch(t){o(t)}}function l(t){t.done?i(t.value):s(t.value).then(r,a)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(i=0)),i)try{if(n=1,s&&(o=a[0]&2?s["return"]:a[0]?s["throw"]||((o=s["return"])&&o.call(s),0):s.next)&&!(o=o.call(s,a[1])).done)return o;if(s=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];s=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function o(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n["throw"](t))}catch(t){r(t)}}function l(t){t.done?i(t.value):s(t.value).then(o,a)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-e6c3f002.js";import{H as Helper}from"./Helper-a7076e76.js";import{a as FilterOptionTypes,F as FilterOptionInputType}from"./interfaces-cb9e8802.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed",7);this.initHeight=195;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((function(){t.page=salla.config.get("page")}));salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.setWidgetHeight=function(t){if(t===void 0){t=250}return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){this.widgetContent.removeAttribute("style");setTimeout((function(){var t=e.widgetContent.offsetHeight;e.widgetContent.style.height=t+"px"}),t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}return t.values.map((function(i,n){var s=typeof i=="number"?i:i.key||i.value;return h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(n)},h("input",{id:"".concat(t.key,"-option-").concat(n),name:t.key,type:t.inputType,checked:e.isSelectedOption(t,s),class:"s-filters-".concat(t.inputType),onChange:function(i){return e.changed.emit({event:i,option:t,value:s})}}),e.getOptionLabel(t,i))}))};t.prototype.isSelectedOption=function(t,e){if(this.page.slug=="product.index"&&this.option.key=="category_id"){return this.page.id==e}if(!this.filtersData||!this.filtersData[t.key]){return false}return t.inputType===FilterOptionInputType.CHECKBOX?this.filtersData[t.key].includes(e):this.filtersData[t.key]==e};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{class:"s-filters-widget-container"},h("h3",{class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",null,this.option.label),h("span",{class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",null),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){return t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-e6c3f002.js";import{H as Helper}from"./Helper-a7076e76.js";import{a as FilterOptionTypes,F as FilterOptionInputType}from"./interfaces-cb9e8802.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed",7);this.initHeight=195;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((function(){t.page=salla.config.get("page")}));salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.setWidgetHeight=function(t){if(t===void 0){t=250}return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){this.widgetContent.removeAttribute("style");setTimeout((function(){var t=e.widgetContent.offsetHeight;e.widgetContent.style.height=t+"px"}),t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}var i=[];var n=[];t.values.forEach((function(s,r){var o=typeof s=="number"?s:s.key||s.value;var a=e.page.slug=="product.index"&&Number(s.key)==e.page.id;var l=h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(r),style:{opacity:a?"0.6":"1"}},h("input",{id:"".concat(t.key,"-option-").concat(r),name:a?"current-category":t.key,type:a?"checkbox":t.inputType,checked:a||e.isSelectedOption(t,o),disabled:a,class:"s-filters-".concat(a?"checkbox":t.inputType),onChange:function(i){return!a?e.changed.emit({event:i,option:t,value:o}):null}}),e.getOptionLabel(t,s));if(a){i.unshift(l)}else{n.push(l)}}));return i.concat(n)};t.prototype.isSelectedOption=function(t,e){if(!this.filtersData||!this.filtersData[t.key]){return false}return t.inputType===FilterOptionInputType.CHECKBOX?this.filtersData[t.key].includes(e):this.filtersData[t.key]==e};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{class:"s-filters-widget-container"},h("h3",{class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",null,this.option.label),h("span",{class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",null),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){return t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
5
5
  //# sourceMappingURL=salla-filters-widget.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sallaFiltersWidgetCss","SallaFiltersWidget","this","initHeight","salla","config","get","class_1","prototype","connectedCallback","_this","withLoadMore","option","key","Array","isArray","values","length","onReady","page","lang","onLoaded","showMoreLabel","getWithDefault","showLessLabel","componentDidLoad","widgetValues","scrollHeight","style","maxHeight","concat","widgetContent","height","setWidgetHeight","delay","removeAttribute","setTimeout","currentWidgetHeight","offsetHeight","reset","type","FilterOptionTypes","RANGE","priceRange","from","host","querySelectorAll","forEach","input","checked","showMore","isShowMore","toggleWidget","isOpen","Helper","toggleElementClassIf","renderFilterOption","VALUES","MINIMUM","VARIANTS","includes","map","filterOption","index","value","h","class","htmlFor","id","name","inputType","isSelectedOption","onChange","e","changed","emit","event","getOptionLabel","slug","filtersData","FilterOptionInputType","CHECKBOX","size","label","render","Host","onClick","ref","el","onChanged","detail","price"],"sources":["src/components/salla-filters-widget/salla-filters-widget.scss?tag=salla-filters-widget","src/components/salla-filters-widget/salla-filters-widget.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, h, Method, State, Prop, Event, Element } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n\n /**\n * Show more or less filter options.\n */\n @Prop({ mutable: true }) withLoadMore: boolean;\n\n /**\n * Selected filter options value.\n */\n @Prop({ reflect: true }) filtersData: object;\n\n /**\n * Filter option along with possible values.\n */\n @Prop({ reflect: true }) option: Filter;\n\n\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n @State() showMoreLabel: string = \"عرض المزيد\";\n @State() showLessLabel: string = \"عرض أقل\";\n @State() page: any = salla.config.get('page');\n\n /**\n * Custom event emitted up on filter option selection changes.\n */\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = this.option.key != 'price' && Array.isArray(this.option.values) && this.option.values.length > 8;\n salla.onReady(() => {\n this.page = salla.config.get('page');\n })\n salla.lang.onLoaded(() => {\n this.showMoreLabel = salla.lang.getWithDefault('common.titles.more', this.showMoreLabel)\n this.showLessLabel = salla.lang.getWithDefault('common.elements.show_less', this.showLessLabel)\n })\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n @Method()\n async setWidgetHeight(delay = 250) {\n this.widgetContent.removeAttribute('style');\n setTimeout(() => {\n let currentWidgetHeight: number = this.widgetContent.offsetHeight;\n this.widgetContent.style.height = currentWidgetHeight + 'px';\n }, delay)\n }\n\n /**\n * Reset selected filter options.\n */\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n /**\n * Action to show more or less filter options.\n */\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n /**\n * Action to toggle widget open or closed (expand/ collapse).\n */\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n //@ts-ignore\n return option.values.map((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n\n return <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${index}`}>\n <input\n id={`${option.key}-option-${index}`}\n name={option.key}\n type={option.inputType}\n //TODO:: debug more why sometimes it's not rendered as selected🤨\n checked={this.isSelectedOption(option, value)}\n class={`s-filters-${option.inputType}`}\n onChange={e => this.changed.emit({ event: e, option: option, value: value })}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n }\n )\n }\n\n private isSelectedOption(option: Filter, value) {\n if (this.page.slug == 'product.index' && this.option.key == 'category_id') {\n return this.page.id == value\n }\n \n if (!this.filtersData || !this.filtersData[option.key]) {\n return false\n }\n\n return option.inputType === FilterOptionInputType.CHECKBOX\n ? this.filtersData[option.key].includes(value)\n : this.filtersData[option.key] == value;\n }\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption} />;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.option.label}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`} />\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot />\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => this.changed.emit(event.detail)}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option} />\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? this.showMoreLabel : this.showLessLabel}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"mappings":";;;6OAAA,IAAMA,sBAAwB,uB,ICQjBC,mBAAkB,W,kFAwBrBC,KAAAC,WAAqB,I,yFAEF,K,gBACI,M,mBACE,a,mBACA,U,UACZC,MAAMC,OAAOC,IAAI,O,CAOtCC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAR,KAEEA,KAAKS,aAAeT,KAAKU,OAAOC,KAAO,SAAWC,MAAMC,QAAQb,KAAKU,OAAOI,SAAWd,KAAKU,OAAOI,OAAOC,OAAS,EACnHb,MAAMc,SAAQ,WACZR,EAAKS,KAAOf,MAAMC,OAAOC,IAAI,O,IAE/BF,MAAMgB,KAAKC,UAAS,WAClBX,EAAKY,cAAgBlB,MAAMgB,KAAKG,eAAe,qBAAsBb,EAAKY,eAC1EZ,EAAKc,cAAgBpB,MAAMgB,KAAKG,eAAe,4BAA6Bb,EAAKc,c,KAIrFjB,EAAAC,UAAAiB,iBAAA,WACEvB,KAAKwB,aAAaC,aAAezB,KAAKC,aAAeD,KAAKS,aAAe,OACxET,KAA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EAAAR,KACE,OACE+D,EAACoB,KAAI,CAACnB,MAAM,8BACVD,EAAA,MAAIC,MAAM,yBAAyBoB,QAAS,WAAM,OAAA5E,EAAK0C,cAAL,GAChDa,EAAA,YAAO/D,KAAKU,OAAOuE,OACnBlB,EAAA,QAAMC,MAAO,8BAAApC,OAA8B5B,KAAKmD,OAAS,oCAAsC,OAEjGY,EAAA,OAAKC,MAAM,2BAA2BqB,IAAK,SAACC,GAAO,OAAA9E,EAAKqB,cAAgByD,CAArB,GACjDvB,EAAA,OAAKC,MAAM,0BAA0BqB,IAAK,SAACC,GAAO,OAAA9E,EAAKgB,aAAe8D,CAApB,GAChDvB,EAAA,aAEE/D,KAAKU,OAAO4B,OAASC,kBAAkBC,MACnCxC,KAAKsD,mBAAmBtD,KAAKU,QAC7BqD,EAAA,qBAAmBwB,UAAW,SAACb,GAAU,OAAAlE,EAAKgE,QAAQC,KAAKC,EAAMc,OAAxB,EACzCH,IAAK,SAAAI,GAAS,OAAAjF,EAAKiC,WAAagD,CAAlB,EACdZ,YAAa7E,KAAK6E,YAClBnE,OAAQV,KAAKU,UAGpBV,KAAKS,cACJsD,EAAA,KAAGC,MAAM,wBACPoB,QAAS,WAAM,OAAA5E,EAAKwC,UAAL,IAAmBhD,KAAKiD,WAAajD,KAAKoB,cAAgBpB,KAAKsB,gB,kIAvK7D,G"}
1
+ {"version":3,"names":["sallaFiltersWidgetCss","SallaFiltersWidget","this","initHeight","salla","config","get","class_1","prototype","connectedCallback","_this","withLoadMore","option","key","Array","isArray","values","length","onReady","page","lang","onLoaded","showMoreLabel","getWithDefault","showLessLabel","componentDidLoad","widgetValues","scrollHeight","style","maxHeight","concat","widgetContent","height","setWidgetHeight","delay","removeAttribute","setTimeout","currentWidgetHeight","offsetHeight","reset","type","FilterOptionTypes","RANGE","priceRange","from","host","querySelectorAll","forEach","input","checked","showMore","isShowMore","toggleWidget","isOpen","Helper","toggleElementClassIf","renderFilterOption","VALUES","MINIMUM","VARIANTS","includes","disabledAndSelectedOption","otherOptions","filterOption","index","value","isDisabledAndSelected","slug","Number","id","label","h","class","htmlFor","opacity","name","inputType","isSelectedOption","disabled","onChange","e","changed","emit","event","getOptionLabel","unshift","push","filtersData","FilterOptionInputType","CHECKBOX","size","render","Host","onClick","ref","el","onChanged","detail","price"],"sources":["src/components/salla-filters-widget/salla-filters-widget.scss?tag=salla-filters-widget","src/components/salla-filters-widget/salla-filters-widget.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, h, Method, State, Prop, Event, Element } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n\n /**\n * Show more or less filter options.\n */\n @Prop({ mutable: true }) withLoadMore: boolean;\n\n /**\n * Selected filter options value.\n */\n @Prop({ reflect: true }) filtersData: object;\n\n /**\n * Filter option along with possible values.\n */\n @Prop({ reflect: true }) option: Filter;\n\n\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n @State() showMoreLabel: string = \"عرض المزيد\";\n @State() showLessLabel: string = \"عرض أقل\";\n @State() page: any = salla.config.get('page');\n\n /**\n * Custom event emitted up on filter option selection changes.\n */\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = this.option.key != 'price' && Array.isArray(this.option.values) && this.option.values.length > 8;\n salla.onReady(() => {\n this.page = salla.config.get('page');\n })\n salla.lang.onLoaded(() => {\n this.showMoreLabel = salla.lang.getWithDefault('common.titles.more', this.showMoreLabel)\n this.showLessLabel = salla.lang.getWithDefault('common.elements.show_less', this.showLessLabel)\n })\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n @Method()\n async setWidgetHeight(delay = 250) {\n this.widgetContent.removeAttribute('style');\n setTimeout(() => {\n let currentWidgetHeight: number = this.widgetContent.offsetHeight;\n this.widgetContent.style.height = currentWidgetHeight + 'px';\n }, delay)\n }\n\n /**\n * Reset selected filter options.\n */\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n /**\n * Action to show more or less filter options.\n */\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n /**\n * Action to toggle widget open or closed (expand/ collapse).\n */\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n \n const disabledAndSelectedOption = [];\n const otherOptions = [];\n \n option.values.forEach((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n \n const isDisabledAndSelected = this.page.slug == 'product.index' && Number(filterOption.key) == this.page.id;\n \n const label = (\n <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${index}`} style={{\"opacity\" : isDisabledAndSelected ? \"0.6\" : \"1\"}}>\n <input\n id={`${option.key}-option-${index}`}\n name={isDisabledAndSelected ? \"current-category\" : option.key}\n type={isDisabledAndSelected ? \"checkbox\" : option.inputType}\n checked={isDisabledAndSelected || this.isSelectedOption(option, value)}\n disabled={isDisabledAndSelected}\n class={`s-filters-${isDisabledAndSelected ? \"checkbox\" : option.inputType}`}\n onChange={e => !isDisabledAndSelected ? this.changed.emit({ event: e, option: option, value: value }) : null}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n );\n \n if (isDisabledAndSelected) {\n disabledAndSelectedOption.unshift(label); // Add to the beginning of the disabledAndSelectedOption array\n } else {\n otherOptions.push(label); // Add to the end of the otherOptions array\n }\n });\n \n return disabledAndSelectedOption.concat(otherOptions);\n }\n \n \n \n\n private isSelectedOption(option: Filter, value) {\n\n \n if (!this.filtersData || !this.filtersData[option.key]) {\n return false\n }\n\n return option.inputType === FilterOptionInputType.CHECKBOX\n ? this.filtersData[option.key].includes(value)\n : this.filtersData[option.key] == value;\n }\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption} />;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.option.label}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`} />\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot />\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => this.changed.emit(event.detail)}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option} />\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? this.showMoreLabel : this.showLessLabel}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"mappings":";;;6OAAA,IAAMA,sBAAwB,uB,ICQjBC,mBAAkB,W,kFAwBrBC,KAAAC,WAAqB,I,yFAEF,K,gBACI,M,mBACE,a,mBACA,U,UACZC,MAAMC,OAAOC,IAAI,O,CAOtCC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAR,KAEEA,KAAKS,aAAeT,KAAKU,OAAOC,KAAO,SAAWC,MAAMC,QAAQb,KAAKU,OAAOI,SAAWd,KAAKU,OAAOI,OAAOC,OAAS,EACnHb,MAAMc,SAAQ,WACZR,EAAKS,KAAOf,MAAMC,OAAOC,IAAI,O,IAE/BF,MAAMgB,KAAKC,UAAS,WAClBX,EAAKY,cAAgBlB,MAAMgB,KAAKG,eAAe,qBAAsBb,EAAKY,eAC1EZ,EAAKc,cAAgBpB,MAAMgB,KAAKG,eAAe,4BAA6Bb,EAAKc,c,KAIrFjB,EAAAC,UAAAiB,iBAAA,WACEvB,KAAKwB,aAAaC,aAAezB,KAAKC,aAAeD,KAAKS,aAAe,OACxET,KAAKS,cAAgBT,KAAKwB,eAAkBxB,KAAKwB,aAAaE,MAAMC,UAAY,GAAAC,OAAG5B,KAAKC,WAAU,OACnGD,KAAK6B,cAAcH,MAAMI,OAAS,GAAAF,OAAG5B,KAAK6B,cAAcJ,aAAY,K,EAIhEpB,EAAAC,UAAAyB,gBAAN,SAAsBC,GAAA,GAAAA,SAAA,GAAAA,EAAA,GAAW,C,gGAC/BhC,KAAK6B,cAAcI,gBAAgB,SACnCC,YAAW,WACT,IAAIC,EAA8B3B,EAAKqB,cAAcO,aACrD5B,EAAKqB,cAAcH,MAAMI,OAASK,EAAsB,I,GACvDH,G,iBAOC3B,EAAAC,UAAA+B,MAAN,W,qFACE,GAAIrC,KAAKU,OAAO4B,OAASC,kBAAkBC,MAAO,C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,oCAAsC,OAEjGkB,EAAA,OAAKC,MAAM,2BAA2BsB,IAAK,SAACC,GAAO,OAAArF,EAAKqB,cAAgBgE,CAArB,GACjDxB,EAAA,OAAKC,MAAM,0BAA0BsB,IAAK,SAACC,GAAO,OAAArF,EAAKgB,aAAeqE,CAApB,GAChDxB,EAAA,aAEErE,KAAKU,OAAO4B,OAASC,kBAAkBC,MACnCxC,KAAKsD,mBAAmBtD,KAAKU,QAC7B2D,EAAA,qBAAmByB,UAAW,SAACb,GAAU,OAAAzE,EAAKuE,QAAQC,KAAKC,EAAMc,OAAxB,EACzCH,IAAK,SAAAI,GAAS,OAAAxF,EAAKiC,WAAauD,CAAlB,EACdX,YAAarF,KAAKqF,YAClB3E,OAAQV,KAAKU,UAGpBV,KAAKS,cACJ4D,EAAA,KAAGC,MAAM,wBACPqB,QAAS,WAAM,OAAAnF,EAAKwC,UAAL,IAAmBhD,KAAKiD,WAAajD,KAAKoB,cAAgBpB,KAAKsB,gB,kIAtL7D,G"}
@@ -1,5 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function l(e){try{o(i.next(e))}catch(e){a(e)}}function s(e){try{o(i["throw"](e))}catch(e){a(e)}}function o(e){e.done?n(e.value):r(e.value).then(l,s)}o((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,l;return l={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function s(e){return function(t){return o([e,t])}}function o(s){if(i)throw new TypeError("Generator is already executing.");while(l&&(l=0,s[0]&&(n=0)),n)try{if(i=1,r&&(a=s[0]&2?r["return"]:s[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;if(r=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1];a=s;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(s);break}if(a[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];r=0}finally{i=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?i(e.value):r(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return l([e,t])}}function l(s){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(i=0)),i)try{if(n=1,r&&(a=s[0]&2?r["return"]:s[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;if(r=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(s[0]===6&&i.label<a[1]){i.label=a[1];a=s;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(s);break}if(a[2])i.ops.pop();i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e];r=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,c as createEvent,h,H as Host}from"./index-e6c3f002.js";var sallaPriceRangeCss=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";var SallaPriceRange=function(){function e(e){registerInstance(this,e);this.changed=createEvent(this,"changed",7);this.filterValues=[];this.minPrice=undefined;this.maxPrice=undefined;this.option=undefined;this.filtersData=undefined;this.min=0;this.max=1e4;this.priceOptions=undefined;this.moreThanLabel="أكثر من";this.lessThanLabel="أقل من";this.toLabel="الى";this.fromLabel="من"}e.prototype.connectedCallback=function(){var e=this;var t;if(this.filtersData&&((t=this.filtersData)===null||t===void 0?void 0:t.price)){this.minPrice=this.filtersData.price.min;this.maxPrice=this.filtersData.price.max}salla.lang.onLoaded((function(){e.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",e.moreThanLabel);e.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",e.lessThanLabel);e.toLabel=salla.lang.getWithDefault("common.elements.to",e.toLabel);e.fromLabel=salla.lang.getWithDefault("common.elements.from",e.fromLabel)}));if(this.option.values.length==1){return}if(this.option.values.length<=5){this.filterValues=this.option.values;return}var n=Math.ceil(this.option.values.length/5);for(var i=0;i<this.option.values.length;i+=n){this.filterValues.push(this.option.values.slice(i,i+n).reduce((function(e,t){e.to=t.to;e.count+=t.count;return e})))}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.minInput.value=null;this.maxInput.value=null;return[2]}))}))};e.prototype.getPriceLabel=function(e){if(isNaN(e.from)||e.from<1){return"".concat(this.lessThanLabel," ").concat(salla.money(e.to))}if(isNaN(e.to)||e.to<1){return"".concat(this.moreThanLabel," ").concat(salla.money(e.from))}return"".concat(salla.money(e.from)," ").concat(this.toLabel," ").concat(salla.money(e.to))};e.prototype.handleMinMaxPrice=function(e,t){this.minPrice=t.from;this.maxPrice=t.to!="*"?t.to:null;this.changedEventHandler(e)};e.prototype.changedEventHandler=function(e,t){if(t===void 0){t=false}return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(i){salla.helpers.inputDigitsOnly(e.target);n=e?e.target.value*1:null;if(t){this.minInputValidation(n)}else{this.maxInputValidation(n)}this.isReady&&this.changed.emit({event:e,option:this.option,value:{max:this.maxPrice,min:this.minPrice}});return[2]}))}))};e.prototype.minInputValidation=function(e){if(e&&(e>this.max||e>this.maxPrice)){return}if(e<this.min){this.minPrice=this.min;return}if(e){this.minPrice=e}};e.prototype.maxInputValidation=function(e){if(e&&(e<this.min||e<this.minPrice)){return}if(e>this.max){this.maxPrice=this.max;return}if(e){this.maxPrice=e}};e.prototype.isChecked=function(e){if(!this.minPrice&&!this.maxPrice){return false}var t=(e.from<1||e.from=="*")&&this.minPrice==0||e.from==this.minPrice;var n=e.to=="*"||!e.to||e.to==this.maxPrice;return t&&n};e.prototype.render=function(){var e=this;return h(Host,null,this.filterValues.map((function(t,n){return h("label",{class:"s-filters-label",htmlFor:"".concat(e.option.key,"-").concat(n)},h("input",{id:"".concat(e.option.key,"-").concat(n),name:"price",type:"radio",checked:e.isChecked(t),class:"s-filters-radio",onChange:function(n){return e.handleMinMaxPrice(n,t)}}),e.getPriceLabel(t))})),h("div",{class:"flex justify-center items-center"},h("div",{class:"relative max-w-xl w-full"},h("div",{class:"s-price-range-inputs"},h("div",{class:"s-price-range-relative"},h("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),h("input",{type:"number",maxlength:"5",ref:function(t){return e.minInput=t},onInput:function(t){return e.changedEventHandler(t,true)},value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),h("div",{class:"s-price-range-gray-text"}," -"),h("div",{class:"s-price-range-relative"},h("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),h("input",{type:"number",maxlength:"5",placeholder:this.toLabel,ref:function(t){return e.maxInput=t},onInput:function(t){return e.changedEventHandler(t)},value:this.maxPrice,class:"s-price-range-number-input","aria-describedby":"price-currency"}))))))};e.prototype.componentDidLoad=function(){this.isReady=true};return e}();SallaPriceRange.style=sallaPriceRangeCss;export{SallaPriceRange as salla_price_range};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host}from"./index-e6c3f002.js";var sallaPriceRangeCss=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";var SallaPriceRange=function(){function e(e){registerInstance(this,e);this.changed=createEvent(this,"changed",7);this.filterValues=[];this.minPrice=undefined;this.maxPrice=undefined;this.option=undefined;this.filtersData=undefined;this.min=0;this.max=1e4;this.priceOptions=undefined;this.moreThanLabel="أكثر من";this.lessThanLabel="أقل من";this.toLabel="الى";this.fromLabel="من";this.typing=false;this.debounce=setTimeout((function(){return""}),1e3)}e.prototype.connectedCallback=function(){var e=this;var t;if(this.filtersData&&((t=this.filtersData)===null||t===void 0?void 0:t.price)){this.minPrice=this.filtersData.price.min;this.maxPrice=this.filtersData.price.max}salla.lang.onLoaded((function(){e.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",e.moreThanLabel);e.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",e.lessThanLabel);e.toLabel=salla.lang.getWithDefault("common.elements.to",e.toLabel);e.fromLabel=salla.lang.getWithDefault("common.elements.from",e.fromLabel)}));if(this.option.values.length==1){return}if(this.option.values.length<=5){this.filterValues=this.option.values;return}var i=Math.ceil(this.option.values.length/5);for(var n=0;n<this.option.values.length;n+=i){this.filterValues.push(this.option.values.slice(n,n+i).reduce((function(e,t){e.to=t.to;e.count+=t.count;return e})))}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.minInput.value=null;this.maxInput.value=null;return[2]}))}))};e.prototype.getPriceLabel=function(e){if(isNaN(e.from)||e.from<1){return"".concat(this.lessThanLabel," ").concat(salla.money(e.to))}if(isNaN(e.to)||e.to<1){return"".concat(this.moreThanLabel," ").concat(salla.money(e.from))}return"".concat(salla.money(e.from)," ").concat(this.toLabel," ").concat(salla.money(e.to))};e.prototype.handleMinMaxPrice=function(e,t){this.minPrice=t.from;this.maxPrice=t.to!="*"?t.to:"";this.changedEventHandler(e)};e.prototype.changedEventHandler=function(e,t){if(t===void 0){t=false}return __awaiter(this,void 0,void 0,(function(){var i;var n=this;return __generator(this,(function(r){this.typing=true;salla.helpers.inputDigitsOnly(e.target);i=e?e.target.value*1:"";clearTimeout(this.debounce);this.debounce=setTimeout((function(){n.typing=false;if(t){if(!n.maxPrice&&i){n.maxPrice=""}n.minInputValidation(i)}else{if(!n.minPrice&&i){n.minPrice=0}n.maxInputValidation(i)}n.isReady&&n.changed.emit({event:e,option:n.option,value:{max:n.maxPrice,min:n.minPrice}})}),1e3);return[2]}))}))};e.prototype.minInputValidation=function(e){if(e&&(e>this.max||this.maxPrice&&e>this.maxPrice)){return}if(e<this.min){this.minPrice=this.min;return}if(e){this.minPrice=e}};e.prototype.maxInputValidation=function(e){if(e&&(e<this.min||this.minPrice&&e<this.minPrice)){return}if(e>this.max){this.maxPrice=this.max;return}if(e){this.maxPrice=e}};e.prototype.isChecked=function(e){if(!this.minPrice&&!this.maxPrice){return false}var t=(e.from<1||e.from=="*")&&this.minPrice==0||e.from==this.minPrice;var i=e.to=="*"||!e.to||e.to==this.maxPrice;return t&&i};e.prototype.render=function(){var e=this;return h(Host,null,this.filterValues.map((function(t,i){return h("label",{class:"s-filters-label",htmlFor:"".concat(e.option.key,"-").concat(i)},h("input",{id:"".concat(e.option.key,"-").concat(i),name:"price",type:"radio",checked:e.isChecked(t),class:"s-filters-radio",onChange:function(i){return e.handleMinMaxPrice(i,t)}}),e.getPriceLabel(t))})),h("div",{class:"flex justify-center items-center"},h("div",{class:"relative max-w-xl w-full"},h("div",{class:"s-price-range-inputs"},h("div",{class:"s-price-range-relative"},h("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),h("input",{type:"number",maxlength:"5",ref:function(t){return e.minInput=t},onInput:function(t){return e.changedEventHandler(t,true)},value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),h("div",{class:"s-price-range-gray-text"}," -"),h("div",{class:"s-price-range-relative"},h("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),h("input",{type:"number",maxlength:"5",placeholder:this.toLabel,ref:function(t){return e.maxInput=t},onInput:function(t){return e.changedEventHandler(t)},value:this.maxPrice,class:"s-price-range-number-input","aria-describedby":"price-currency"}))))))};e.prototype.componentDidLoad=function(){this.isReady=true};return e}();SallaPriceRange.style=sallaPriceRangeCss;export{SallaPriceRange as salla_price_range};
5
5
  //# sourceMappingURL=salla-price-range.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sallaPriceRangeCss","SallaPriceRange","this","filterValues","class_1","prototype","connectedCallback","_this","filtersData","_a","price","minPrice","min","maxPrice","max","salla","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","concat","money","handleMinMaxPrice","event","changedEventHandler","isMin","helpers","inputDigitsOnly","target","minInputValidation","maxInputValidation","isReady","changed","emit","isChecked","isMinEqual","isMaxEqual","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","config","currency","symbol","maxlength","ref","el","onInput","placeholder","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import {Component, Host, h, State, Prop, Event, Method} from '@stencil/core';\nimport {Filter, FilterValue} from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({mutable: true}) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({mutable: true}) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({reflect: true}) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({reflect: true}) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string=\"أكثر من\";\n @State() lessThanLabel: string=\"أقل من\";\n @State() toLabel: string=\"الى\";\n @State() fromLabel: string=\"من\";\n\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel=salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel=salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel=salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel=salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n /**\n * reset the price range inputs\n */\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to != '*' ? value.to : null;\n\n this.changedEventHandler(event);\n }\n\n private async changedEventHandler(event, isMin = false) {\n salla.helpers.inputDigitsOnly(event.target)\n let value = event ? event.target.value * 1 : null\n if (isMin) {\n this.minInputValidation(value);\n } else {\n this.maxInputValidation(value)\n }\n\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: {max: this.maxPrice, min: this.minPrice}\n })\n }\n\n\n minInputValidation(value) {\n if (value && (value > this.max || value > this.maxPrice)) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || value < this.minPrice)) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n\n if (value) {\n this.maxPrice = value;\n }\n }\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onInput={(event) => this.changedEventHandler(event, true)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input type=\"number\" maxlength=\"5\"\n placeholder={this.toLabel}\n ref={el => this.maxInput = el}\n onInput={(event) => this.changedEventHandler(event)}\n value={this.maxPrice}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\"/>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;uFAAA,IAAMA,mBAAqB,0nB,ICOdC,gBAAe,W,kFAsC1BC,KAAAC,aAAmC,G,0GAhBpB,E,SACA,I,+CAEgB,U,mBACA,S,aACN,M,eACE,I,CAa3BC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAL,K,MACE,GAAIA,KAAKM,eAAeC,EAAAP,KAAKM,eAAW,MAAAC,SAAA,SAAAA,EAAEC,OAAO,CAC/CR,KAAKS,SAAWT,KAAKM,YAAYE,MAAME,IACvCV,KAAKW,SAAWX,KAAKM,YAAYE,MAAMI,G,CAEzCC,MAAMC,KAAKC,UAAS,WAClBV,EAAKW,cAAcH,MAAMC,KAAKG,eAAe,4BAA6BZ,EAAKW,eAC/EX,EAAKa,cAAcL,MAAMC,KAAKG,eAAe,4BAA6BZ,EAAKa,eAC/Eb,EAAKc,QAAQN,MAAMC,KAAKG,eAAe,qBAAsBZ,EAAKc,SAClEd,EAAKe,UAAUP,MAAMC,KAAKG,eAAe,uBAAwBZ,EAAKe,U,IAI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1
+ {"version":3,"names":["sallaPriceRangeCss","SallaPriceRange","this","filterValues","setTimeout","class_1","prototype","connectedCallback","_this","filtersData","_a","price","minPrice","min","maxPrice","max","salla","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","concat","money","handleMinMaxPrice","event","changedEventHandler","isMin","typing","helpers","inputDigitsOnly","target","clearTimeout","debounce","minInputValidation","maxInputValidation","isReady","changed","emit","isChecked","isMinEqual","isMaxEqual","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","config","currency","symbol","maxlength","ref","el","onInput","placeholder","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import { Component, Host, h, State, Prop, Event, Method } from '@stencil/core';\nimport { Filter, FilterValue } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({ mutable: true }) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({ mutable: true }) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({ reflect: true }) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({ reflect: true }) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string = \"أكثر من\";\n @State() lessThanLabel: string = \"أقل من\";\n @State() toLabel: string = \"الى\";\n @State() fromLabel: string = \"من\";\n @State() typing: boolean = false;\n @State() debounce: ReturnType<typeof setTimeout> = setTimeout(() => '', 1000);\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel = salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel = salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel = salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel = salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n /**\n * reset the price range inputs\n */\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to != '*' ? value.to : \"\";\n\n this.changedEventHandler(event);\n }\n\n private async changedEventHandler(event, isMin = false) {\n this.typing = true;\n salla.helpers.inputDigitsOnly(event.target)\n let value = event ? event.target.value * 1 : \"\"\n clearTimeout(this.debounce)\n this.debounce = setTimeout(() => {\n this.typing = false\n if (isMin) {\n if (!this.maxPrice && value) {\n this.maxPrice = '';\n }\n this.minInputValidation(value);\n } else {\n if (!this.minPrice && value) {\n this.minPrice = 0;\n }\n this.maxInputValidation(value)\n }\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: { max: this.maxPrice, min: this.minPrice }\n })\n\n }, 1000)\n }\n\n\n minInputValidation(value) {\n if (value && (value > this.max || (this.maxPrice && value > this.maxPrice))) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || (this.minPrice && value < this.minPrice))) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n\n if (value) {\n this.maxPrice = value;\n }\n }\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onInput={(event) => this.changedEventHandler(event, true)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input type=\"number\" maxlength=\"5\"\n placeholder={this.toLabel}\n ref={el => this.maxInput = el}\n onInput={(event) => this.changedEventHandler(event)}\n value={this.maxPrice}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\" />\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;uFAAA,IAAMA,mBAAqB,0nB,ICOdC,gBAAe,W,kFAuC1BC,KAAAC,aAAmC,G,0GAjBpB,E,SACA,I,+CAEkB,U,mBACA,S,aACN,M,eACE,K,YACF,M,cACwBC,YAAW,WAAM,WAAI,I,CAYxEC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAN,K,MACE,GAAIA,KAAKO,eAAeC,EAAAR,KAAKO,eAAW,MAAAC,SAAA,SAAAA,EAAEC,OAAO,CAC/CT,KAAKU,SAAWV,KAAKO,YAAYE,MAAME,IACvCX,KAAKY,SAAWZ,KAAK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XC,QAAS,SAACrC,GAAU,OAAAzC,EAAK0C,oBAAoBD,EAAO,KAAhC,EACpBT,MAAOtC,KAAKU,SACZ2E,YAAarF,KAAKqB,UAClBgD,MAAM,gCAIVJ,EAAA,OAAKI,MAAM,2BAAyB,MACpCJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGvD,MAAMgE,OAAOC,WAAWC,QAC9Df,EAAA,SAAOS,KAAK,SAASO,UAAU,IAC7BI,YAAarF,KAAKoB,QAClB8D,IAAK,SAAAC,GAAM,OAAA7E,EAAKiC,SAAW4C,CAAhB,EACXC,QAAS,SAACrC,GAAU,OAAAzC,EAAK0C,oBAAoBD,EAAzB,EACpBT,MAAOtC,KAAKY,SACZyD,MAAM,6BAA4B,mBAAkB,uB,EASpElE,EAAAC,UAAAkF,iBAAA,WACEtF,KAAK0D,QAAU,I,WAjPS,G"}
@@ -1,5 +1,5 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):i(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):i(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-e6c3f002.js";import{a as anime}from"./anime.es-6b92d9cd.js";import{H as Helper}from"./Helper-a7076e76.js";var ShoppingBag='\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>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var sallaProductsListCss="";var SallaProductsList=function(){function e(e){registerInstance(this,e);this.productsFetched=createEvent(this,"productsFetched",7);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.sortBy=undefined;this.filtersResults=undefined;this.horizontalCards=undefined;this.productCardComponent="custom-salla-product-card";this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.parsedFilters=undefined}e.prototype.connectedCallback=function(){var e=this;salla.event.on("salla-filters::changed",(function(t){return e.setFilters(t)}))};e.prototype.setFilters=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(!!e&&JSON.stringify(this.parsedFilters)===JSON.stringify(e)){return[2]}window.scrollTo({top:0,behavior:"smooth"});this.parsedFilters=e;return[2,this.reload()]}))}))};e.prototype.reload=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";this.init();return[2]}))}))};e.prototype.isFilterable=function(){return salla.config.get("store.settings.product.filters")&&this.filtersResults};e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.animateItems=function(){anime({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(e,t){return t*100}})};e.prototype.createStatusDom=function(){var e=this;this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){e.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");e.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");e.placeholderText=salla.lang.get("pages.categories.no_products")}))};e.prototype.initBaseNextPageUrl=function(e){var t=this;this.nextPage=salla.url.api("products?source=".concat(e));if(this.limit){this.nextPage+="&per_page=".concat(this.limit>32?32:this.limit)}if(this.sortBy){this.nextPage+="&sort=".concat(this.sortBy)}this.nextPage+="&filterable=1";var n=function(e,n){if(["string","number"].includes(typeof n)){r.nextPage+="&filters[".concat(encodeURIComponent(e),"]=").concat(encodeURIComponent(n))}else if(Array.isArray(n)){n.forEach((function(n){return t.nextPage+="&filters[".concat(encodeURIComponent(e),"][]=").concat(encodeURIComponent(n))}))}else if(typeof n==="object"){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=o[i],a=s[0],l=s[1];r.nextPage+="&filters[".concat(encodeURIComponent(e),"][").concat(encodeURIComponent(a),"]=").concat(encodeURIComponent(l))}}};var r=this;for(var i=0,o=Object.entries(this.parsedFilters||{});i<o.length;i++){var s=o[i],a=s[0],l=s[1];n(a,l)}};e.prototype.buildNextPageUrl=function(){var e=this.getSource();if(e==="json"){return}this.initBaseNextPageUrl(e);if(this.isSourceWithoutValue()){return}if(["search","related","landing-page"].includes(e)){this.nextPage+="&source_value=".concat(this.getSourceValue());return}try{this.nextPage+="&source_value[]=".concat(this.getSourceValue().join("&source_value[]="))}catch(t){salla.logger.warn('source-value prop should be array of ids ex source-value="[1,2,3]" for the source ['.concat(e,"]"));this.sourceValueIsValid=false}};e.prototype.loading=function(e){if(e===void 0){e=true}this.btnLoader.style.display=e?"inherit":"none"};e.prototype.getItemHTML=function(e){this.getSource()==="landing-page"&&(e.url="");var t=this.hasCustomComponent?this.productCardComponent:"salla-product-card";var n=document.createElement(t);n.product=e;this.applyLandingPageStyles(n);this.applyHorizontalCardStyles(n);return n};e.prototype.applyLandingPageStyles=function(e){if(this.getSource()==="landing-page"&&!this.hasCustomComponent){e.toggleAttribute("hide-add-btn",true);e.classList.add("s-product-card-fit-height")}};e.prototype.applyHorizontalCardStyles=function(e){if(!this.horizontalCards){return}e.setAttribute("horizontal",true);if(!this.hasCustomComponent){e.setAttribute("shadow-on-hover",true)}};e.prototype.getSource=function(){return Helper.getProductsSource(this.source)};e.prototype.getSourceValue=function(){return Helper.getProductsSourceValue(this.source,this.sourceValue)};e.prototype.appendDataLayer=function(e){var t=document.createElement("script");var n={event:"impressions",ecommerce:{currencyCode:salla.config.get("user.currency_code"),impressions:e.map((function(e){return{id:e.id,name:e.name,price:e.price,brand:"",quantity:e.quantity,variant:"",categories:[{name:salla.config.get("page.title"),id:salla.config.get("page.id")}],category:salla.config.get("page.title")}})),page:{pageName:salla.config.get("page.slug"),mobileApp:0,referrer:document.referrer,theme:salla.config.get("theme.name")}}};t.appendChild(document.createTextNode("window.dataLayer = window.dataLayer || [];"));t.appendChild(document.createTextNode("window.dataLayer.push("+JSON.stringify(n)+");"));document.head.appendChild(t)};e.prototype.initiateInfiniteScroll=function(){var e=this;var t,n,r;if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("beforeend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return e.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:100},true);(t=this.infiniteScroll)===null||t===void 0?void 0:t.on("request",(function(){return e.loading()}));(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("load",(function(t){var n;if(!((n=t.data)===null||n===void 0?void 0:n.length)&&e.infiniteScroll.pageIndex==2){e.showPlaceholder=true;salla.infiniteScroll.destroy(e.infiniteScroll);e.loading(false);return}else{e.showPlaceholder=false}e.infiniteScroll.appendItems(e.handleResponse(t));if(e.infiniteScroll.pageIndex==2){e.animateItems()}}));(r=this.infiniteScroll)===null||r===void 0?void 0:r.on("error",(function(){e.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");e.loading(false)}));salla.onReady((function(){return salla.infiniteScroll.loadNextPage(e.infiniteScroll)}))};e.prototype.componentWillLoad=function(){var e=this;return Helper.onSallaReadyPromise((function(){e.hasCustomComponent=!!customElements.get(e.productCardComponent);e.sourceValueIsValid=!!(e.getSourceValue()||e.isSourceWithoutValue());e.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(e.getSource())&&!e.limit;try{var t=new URLSearchParams(window.location.search);e.sortBy=e.sortBy||t.get("sort")||t.get("by");var n=t.get("filters");e.parsedFilters=n?JSON.parse(decodeURIComponent(n)):{}}catch(e){salla.logger.warn("failed to get filters from url",e.message)}e.buildNextPageUrl();e.createStatusDom();e.isReady=true;if(!e.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(e.getSource(),"]"));return}if(e.hasInfiniteScroll){return}if(e.getSource()==="json"){if(!e.getSourceValue().length){e.showPlaceholder=true;return}setTimeout((function(){e.getSourceValue().map((function(t){return e.wrapper.append(e.getItemHTML(t))}))}));return}if(e.getSource()==="selected"&&!e.getSourceValue().length){e.showPlaceholder=true;return}return Helper.fetchProducts(e.getSource(),e.getSourceValue(),e.limit).then((function(t){if(!t.data.length){e.showPlaceholder=true;e.loading(false);return}setTimeout((function(){e.handleResponse(t).forEach((function(t){return e.wrapper.append(t)}))}),100)}))}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.render=function(){var e=this;if(!this.canRender()){return""}if(this.showPlaceholder){return h("div",{class:"s-products-list-placeholder"},h("span",{innerHTML:ShoppingBag}),h("p",null,this.placeholderText))}return h(Host,{class:"s-products-list"},h("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.filtersResults,"s-products-list-filters-results":this.filtersResults},ref:function(t){return e.wrapper=t}}))};e.prototype.componentDidLoad=function(){this.hasInfiniteScroll&&this.init()};e.prototype.init=function(){this.initiateInfiniteScroll();this.loading()};e.prototype.handleResponse=function(e){var t=this;var n,r,i,o,s,a;var l=this.getSource();var c="";if(((n=e.cursor)===null||n===void 0?void 0:n.current)===1){c=Helper.getPageTitleForSource(l);try{if(this.getSource()==="search"){c=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()})}else if(!c){var u=this.parsedFilters.category_id||this.getSourceValue()[0];c=((o=(i=(r=e.filters.find((function(e){return e.key=="category_id"})))===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.find((function(e){return e.key==u})))===null||o===void 0?void 0:o.value)||""}c+=(c?" - ":"")+salla.lang.choice("blocks.header.products_count",(s=e.data)===null||s===void 0?void 0:s.length);if(e.data.length===15){c=c.replace(e.data.length,salla.lang.get("common.elements.more_than")+" "+e.data.length)}e.title=c}catch(e){}}salla.event.emit("salla-products-list::products.fetched",e);this.productsFetched.emit(e);if(e.filters&&this.isFilterable()){this.filtersResults=true;salla.event.emit("filters::fetched",{filters:e.filters})}else if(this.isFilterable()){salla.event.emit("filters::hidden")}this.nextPage=e.cursor?e.cursor.next:this.nextPage;this.loading(false);if(this.hasInfiniteScroll&&!this.nextPage){this.infiniteScroll.option({scrollThreshold:false,loadOnScroll:false});this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")}return((a=e.data)===null||a===void 0?void 0:a.map((function(e){return t.getItemHTML(e)})))||[]};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaProductsList.style=sallaProductsListCss;export{SallaProductsList as salla_products_list};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-e6c3f002.js";import{a as anime}from"./anime.es-6b92d9cd.js";import{H as Helper}from"./Helper-a7076e76.js";var ShoppingBag='\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>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var sallaProductsListCss="";var SallaProductsList=function(){function e(e){var t=this;registerInstance(this,e);this.productsFetched=createEvent(this,"productsFetched",7);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.sortBy=undefined;this.filtersResults=undefined;this.horizontalCards=undefined;this.autoload=false;this.loadMoreText=undefined;this.productCardComponent="custom-salla-product-card";this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=salla.lang.get("pages.categories.no_products");this.endOfText=salla.lang.get("common.elements.end_of_content");this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more");this.isReady=undefined;this.showPlaceholder=undefined;this.parsedFilters=undefined;salla.lang.onLoaded((function(){t.placeholderText=salla.lang.get("pages.categories.no_products");t.endOfText=salla.lang.get("common.elements.end_of_content");t.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more")}))}e.prototype.connectedCallback=function(){var e=this;salla.event.on("salla-filters::changed",(function(t){return e.setFilters(t)}))};e.prototype.setFilters=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(!!e&&JSON.stringify(this.parsedFilters)===JSON.stringify(e)){return[2]}window.scrollTo({top:0,behavior:"smooth"});this.parsedFilters=e;return[2,this.reload()]}))}))};e.prototype.reload=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none");salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";this.init();return[2]}))}))};e.prototype.isFilterable=function(){return salla.config.get("store.settings.product.filters")&&this.filtersResults};e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.animateItems=function(){anime({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(e,t){return t*100}})};e.prototype.initBaseNextPageUrl=function(e){var t=this;this.nextPage=salla.url.api("products?source=".concat(e));if(this.limit){this.nextPage+="&per_page=".concat(this.limit>32?32:this.limit)}if(this.sortBy){this.nextPage+="&sort=".concat(this.sortBy)}this.nextPage+="&filterable=1";var n=function(e,n){if(["string","number"].includes(typeof n)){r.nextPage+="&filters[".concat(encodeURIComponent(e),"]=").concat(encodeURIComponent(n))}else if(Array.isArray(n)){n.forEach((function(n){return t.nextPage+="&filters[".concat(encodeURIComponent(e),"][]=").concat(encodeURIComponent(n))}))}else if(typeof n==="object"){for(var i=0,o=Object.entries(n);i<o.length;i++){var a=o[i],s=a[0],l=a[1];r.nextPage+="&filters[".concat(encodeURIComponent(e),"][").concat(encodeURIComponent(s),"]=").concat(encodeURIComponent(l))}}};var r=this;for(var i=0,o=Object.entries(this.parsedFilters||{});i<o.length;i++){var a=o[i],s=a[0],l=a[1];n(s,l)}};e.prototype.buildNextPageUrl=function(){var e=this.getSource();if(e==="json"){return}this.initBaseNextPageUrl(e);if(this.isSourceWithoutValue()){return}if(["search","related","landing-page"].includes(e)){this.nextPage+="&source_value=".concat(this.getSourceValue());return}try{this.nextPage+="&source_value[]=".concat(this.getSourceValue().join("&source_value[]="))}catch(t){salla.logger.warn('source-value prop should be array of ids ex source-value="[1,2,3]" for the source ['.concat(e,"]"));this.sourceValueIsValid=false}};e.prototype.loading=function(e,t){if(e===void 0){e=true}if(t===void 0){t=false}if(!e){if(!this.autoload){this.btnLoader&&(this.btnLoader.style.display="none")}this.loader&&(this.loader.style.display="none")}else{var n=t&&!this.autoload?this.btnLoader:this.loader;n&&(n.style.display="inherit")}};e.prototype.getItemHTML=function(e){this.getSource()==="landing-page"&&(e.url="");var t=this.hasCustomComponent?this.productCardComponent:"salla-product-card";var n=document.createElement(t);n.product=e;this.applyLandingPageStyles(n);this.applyHorizontalCardStyles(n);return n};e.prototype.applyLandingPageStyles=function(e){if(this.getSource()==="landing-page"&&!this.hasCustomComponent){e.toggleAttribute("hide-add-btn",true);e.classList.add("s-product-card-fit-height")}};e.prototype.applyHorizontalCardStyles=function(e){if(!this.horizontalCards){return}e.setAttribute("horizontal",true);if(!this.hasCustomComponent){e.setAttribute("shadow-on-hover",true)}};e.prototype.getSource=function(){return Helper.getProductsSource(this.source)};e.prototype.getSourceValue=function(){return Helper.getProductsSourceValue(this.source,this.sourceValue)};e.prototype.appendDataLayer=function(e){var t=document.createElement("script");var n={event:"impressions",ecommerce:{currencyCode:salla.config.get("user.currency_code"),impressions:e.map((function(e){return{id:e.id,name:e.name,price:e.price,brand:"",quantity:e.quantity,variant:"",categories:[{name:salla.config.get("page.title"),id:salla.config.get("page.id")}],category:salla.config.get("page.title")}})),page:{pageName:salla.config.get("page.slug"),mobileApp:0,referrer:document.referrer,theme:salla.config.get("theme.name")}}};t.appendChild(document.createTextNode("window.dataLayer = window.dataLayer || [];"));t.appendChild(document.createTextNode("window.dataLayer.push("+JSON.stringify(n)+");"));document.head.appendChild(t)};e.prototype.initiateInfiniteScroll=function(){var e=this;var t,n,r;if(!this.hasInfiniteScroll){return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return e.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:this.autoload?100:false,loadOnScroll:this.autoload},true);(t=this.infiniteScroll)===null||t===void 0?void 0:t.on("request",(function(){e.loading(true,e.autoload?false:true)}));(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("load",(function(t){var n;if(!((n=t.data)===null||n===void 0?void 0:n.length)&&e.infiniteScroll.pageIndex==2){e.showPlaceholder=true;salla.infiniteScroll.destroy(e.infiniteScroll);e.loading(false);return}else{e.showPlaceholder=false}e.infiniteScroll.appendItems(e.handleResponse(t));if(e.infiniteScroll.pageIndex==2){if(!e.autoload&&e.nextPage){e.loadMoreWrapper.style.display="block"}e.animateItems()}}));(r=this.infiniteScroll)===null||r===void 0?void 0:r.on("error",(function(){e.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");e.loading(false)}));salla.onReady((function(){return salla.infiniteScroll.loadNextPage(e.infiniteScroll)}))};e.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){(e=this.infiniteScroll)===null||e===void 0?void 0:e.loadNextPage();return[2]}))}))};e.prototype.componentWillLoad=function(){var e=this;return Helper.onSallaReadyPromise((function(){e.hasCustomComponent=!!customElements.get(e.productCardComponent);e.sourceValueIsValid=!!(e.getSourceValue()||e.isSourceWithoutValue());e.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(e.getSource())&&!e.limit;try{var t=new URLSearchParams(window.location.search);e.sortBy=e.sortBy||t.get("sort")||t.get("by");var n={};t.forEach((function(e,t){var r=t.match(/^filters\[(\w+)\](\[(\w+)\])?$/);if(r){var i=r[1];var o=r[3];if(o){n[i]=n[i]||{};n[i][o]=e}else{n[i]=e}}}));e.parsedFilters=n}catch(e){salla.logger.warn("failed to get filters from url",e.message)}e.buildNextPageUrl();e.isReady=true;if(!e.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(e.getSource(),"]"));return}if(e.hasInfiniteScroll){return}if(e.getSource()==="json"){if(!e.getSourceValue().length){e.showPlaceholder=true;return}setTimeout((function(){e.getSourceValue().map((function(t){return e.wrapper.append(e.getItemHTML(t))}))}));return}if(e.getSource()==="selected"&&!e.getSourceValue().length){e.showPlaceholder=true;return}return Helper.fetchProducts(e.getSource(),e.getSourceValue(),e.limit).then((function(t){if(!t.data.length){e.showPlaceholder=true;e.loading(false);return}setTimeout((function(){e.handleResponse(t).forEach((function(t){return e.wrapper.append(t)}))}),100)}))}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.render=function(){var e=this;if(!this.canRender()){return""}if(this.showPlaceholder){return h("div",{class:"s-products-list-placeholder"},h("span",{innerHTML:ShoppingBag}),h("p",null,this.placeholderText))}return h(Host,{class:"s-products-list"},h("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.filtersResults,"s-products-list-filters-results":this.filtersResults},ref:function(t){return e.wrapper=t}}),h("div",{class:"s-infinite-scroll-status",ref:function(t){return e.status=t}},h("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),h("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),this.hasInfiniteScroll&&h("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:function(t){return e.loader=t}},h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?h("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:function(t){return e.loadMoreWrapper=t}},h("button",{onClick:function(){return e.loadMore()},class:"s-infinite-scroll-btn s-button-btn s-button-primary"},h("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:function(t){return e.btnLoader=t},style:{display:"none"}}))):"")};e.prototype.componentDidLoad=function(){this.hasInfiniteScroll&&this.init()};e.prototype.init=function(){this.initiateInfiniteScroll();this.loading()};e.prototype.handleResponse=function(e){var t=this;var n,r,i,o,a,s;var l=this.getSource();var c="";if(((n=e.cursor)===null||n===void 0?void 0:n.current)===1){c=Helper.getPageTitleForSource(l);try{if(this.getSource()==="search"){c=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()})}else if(!c){var u=this.parsedFilters.category_id||this.getSourceValue()[0];c=((o=(i=(r=e.filters.find((function(e){return e.key=="category_id"})))===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.find((function(e){return e.key==u})))===null||o===void 0?void 0:o.value)||""}c+=(c?" - ":"")+salla.lang.choice("blocks.header.products_count",(a=e.data)===null||a===void 0?void 0:a.length);if(e.data.length===15){c=c.replace(e.data.length,salla.lang.get("common.elements.more_than")+" "+e.data.length)}e.title=c}catch(e){}}salla.event.emit("salla-products-list::products.fetched",e);this.productsFetched.emit(e);if(e.filters&&this.isFilterable()){this.filtersResults=true;salla.event.emit("filters::fetched",{filters:e.filters})}else if(this.isFilterable()){salla.event.emit("filters::hidden")}this.nextPage=e.cursor?e.cursor.next:this.nextPage;this.loading(false);if(this.hasInfiniteScroll&&!this.nextPage){this.infiniteScroll.option({scrollThreshold:false,loadOnScroll:false});this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")}return((s=e.data)===null||s===void 0?void 0:s.map((function(e){return t.getItemHTML(e)})))||[]};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaProductsList.style=sallaProductsListCss;export{SallaProductsList as salla_products_list};
5
5
  //# sourceMappingURL=salla-products-list.entry.js.map