@salla.sa/twilight-components 2.12.71 → 2.12.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js +9 -1
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +12 -8
- package/dist/cjs/salla-filters-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +28 -15
- package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +54 -27
- package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +9 -1
- package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js.map +1 -1
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +12 -8
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js.map +1 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js +31 -16
- package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +91 -27
- package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
- package/dist/components/salla-bottom-alert.js +9 -1
- package/dist/components/salla-bottom-alert.js.map +1 -1
- package/dist/components/salla-filters-widget2.js +12 -8
- package/dist/components/salla-filters-widget2.js.map +1 -1
- package/dist/components/salla-price-range2.js +30 -15
- package/dist/components/salla-price-range2.js.map +1 -1
- package/dist/components/salla-products-list.js +58 -27
- package/dist/components/salla-products-list.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_47.entry.js +9 -1
- package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm/salla-filters-widget.entry.js +12 -8
- package/dist/esm/salla-filters-widget.entry.js.map +1 -1
- package/dist/esm/salla-price-range.entry.js +28 -15
- package/dist/esm/salla-price-range.entry.js.map +1 -1
- package/dist/esm/salla-products-list.entry.js +54 -27
- package/dist/esm/salla-products-list.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm-es5/salla-filters-widget.entry.js +2 -2
- package/dist/esm-es5/salla-filters-widget.entry.js.map +1 -1
- package/dist/esm-es5/salla-price-range.entry.js +2 -2
- package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-list.entry.js +2 -2
- package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/p-06d0f1fc.system.entry.js +5 -0
- package/dist/twilight/p-06d0f1fc.system.entry.js.map +1 -0
- package/dist/twilight/p-2059b78a.system.js +1 -1
- package/dist/twilight/p-2059b78a.system.js.map +1 -1
- package/dist/twilight/{p-2f8608f8.system.entry.js → p-65b34312.system.entry.js} +2 -2
- package/dist/twilight/p-65b34312.system.entry.js.map +1 -0
- package/dist/twilight/{p-29f9af2d.entry.js → p-69b9d426.entry.js} +2 -2
- package/dist/twilight/p-69b9d426.entry.js.map +1 -0
- package/dist/twilight/p-73543cab.entry.js +5 -0
- package/dist/twilight/p-73543cab.entry.js.map +1 -0
- package/dist/twilight/p-b095f117.system.entry.js +5 -0
- package/dist/twilight/p-b095f117.system.entry.js.map +1 -0
- package/dist/twilight/p-c868470b.entry.js +5 -0
- package/dist/twilight/p-c868470b.entry.js.map +1 -0
- package/dist/twilight/{p-5bf1cc00.system.entry.js → p-d28aa599.system.entry.js} +2 -2
- package/dist/twilight/p-d28aa599.system.entry.js.map +1 -0
- package/dist/twilight/p-f5558708.entry.js +5 -0
- package/dist/twilight/p-f5558708.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/types/components/salla-filters-widget/salla-filters-widget.d.ts +1 -1
- package/dist/types/components/salla-price-range/salla-price-range.d.ts +2 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +14 -1
- package/dist/types/components.d.ts +16 -0
- package/package.json +5 -5
- package/dist/twilight/p-070d4e23.system.entry.js +0 -5
- package/dist/twilight/p-070d4e23.system.entry.js.map +0 -1
- package/dist/twilight/p-098528e4.entry.js +0 -5
- package/dist/twilight/p-098528e4.entry.js.map +0 -1
- package/dist/twilight/p-27fb76ab.entry.js +0 -5
- package/dist/twilight/p-27fb76ab.entry.js.map +0 -1
- package/dist/twilight/p-29f9af2d.entry.js.map +0 -1
- package/dist/twilight/p-2f8608f8.system.entry.js.map +0 -1
- package/dist/twilight/p-52890817.entry.js +0 -5
- package/dist/twilight/p-52890817.entry.js.map +0 -1
- package/dist/twilight/p-5bf1cc00.system.entry.js.map +0 -1
- package/dist/twilight/p-c944174c.system.entry.js +0 -5
- package/dist/twilight/p-c944174c.system.entry.js.map +0 -1
package/dist/cjs/twilight.cjs.js
CHANGED
|
@@ -23,7 +23,7 @@ const patchBrowser = () => {
|
|
|
23
23
|
|
|
24
24
|
patchBrowser().then(options => {
|
|
25
25
|
appGlobals.globalScripts();
|
|
26
|
-
return index.bootstrapLazy(JSON.parse("[[\"salla-products-slider.cjs\",[[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.cjs\",[[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.cjs\",[[0,\"salla-filters\",{\"filters\":[1040],\"isSidebarOpen\":[32],\"filtersData\":[32],\"apply\":[32],\"reset\":[32],\"getFilters\":[64],\"applyFilters\":[64],\"resetFilters\":[64]}]]],[\"salla-notifications.cjs\",[[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.cjs\",[[0,\"salla-advertisement\",{\"position\":[32],\"advertisements\":[32],\"advertIcon\":[32],\"currentSlug\":[32]}]]],[\"salla-apps-icons.cjs\",[[0,\"salla-apps-icons\",{\"hideTitle\":[4,\"hide-title\"],\"appsTitle\":[1,\"apps-title\"],\"vertical\":[4],\"apps\":[32]}]]],[\"salla-contacts.cjs\",[[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.cjs\",[[0,\"salla-installment\",{\"price\":[1],\"language\":[1],\"currency\":[1],\"tamaraIsActive\":[32],\"tabbyIsActive\":[32],\"spotiiIsActive\":[32]}]]],[\"salla-loyalty-prize-item.cjs\",[[0,\"salla-loyalty-prize-item\",{\"item\":[16]}]]],[\"salla-payments.cjs\",[[0,\"salla-payments\",{\"withSbc\":[4,\"with-sbc\"],\"sbcId\":[1,\"sbc-id\"],\"withMadeInKsa\":[4,\"with-made-in-ksa\"],\"payments\":[32],\"placeholderImage\":[32]}]]],[\"salla-products-list.cjs\",[[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.cjs\",[[0,\"salla-social\",{\"links\":[32],\"iconsList\":[32]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]],[\"salla-notification-item.cjs\",[[0,\"salla-notification-item\",{\"notification\":[16]}]]],[\"salla-price-range.cjs\",[[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.cjs\",[[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.cjs\",[[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]}]]]]"), options);
|
|
26
|
+
return index.bootstrapLazy(JSON.parse("[[\"salla-products-slider.cjs\",[[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.cjs\",[[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.cjs\",[[0,\"salla-filters\",{\"filters\":[1040],\"isSidebarOpen\":[32],\"filtersData\":[32],\"apply\":[32],\"reset\":[32],\"getFilters\":[64],\"applyFilters\":[64],\"resetFilters\":[64]}]]],[\"salla-notifications.cjs\",[[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.cjs\",[[0,\"salla-advertisement\",{\"position\":[32],\"advertisements\":[32],\"advertIcon\":[32],\"currentSlug\":[32]}]]],[\"salla-apps-icons.cjs\",[[0,\"salla-apps-icons\",{\"hideTitle\":[4,\"hide-title\"],\"appsTitle\":[1,\"apps-title\"],\"vertical\":[4],\"apps\":[32]}]]],[\"salla-contacts.cjs\",[[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.cjs\",[[0,\"salla-installment\",{\"price\":[1],\"language\":[1],\"currency\":[1],\"tamaraIsActive\":[32],\"tabbyIsActive\":[32],\"spotiiIsActive\":[32]}]]],[\"salla-loyalty-prize-item.cjs\",[[0,\"salla-loyalty-prize-item\",{\"item\":[16]}]]],[\"salla-payments.cjs\",[[0,\"salla-payments\",{\"withSbc\":[4,\"with-sbc\"],\"sbcId\":[1,\"sbc-id\"],\"withMadeInKsa\":[4,\"with-made-in-ksa\"],\"payments\":[32],\"placeholderImage\":[32]}]]],[\"salla-products-list.cjs\",[[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.cjs\",[[0,\"salla-social\",{\"links\":[32],\"iconsList\":[32]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]],[\"salla-notification-item.cjs\",[[0,\"salla-notification-item\",{\"notification\":[16]}]]],[\"salla-price-range.cjs\",[[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.cjs\",[[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.cjs\",[[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]}]]]]"), options);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
exports.setNonce = index.setNonce;
|
|
@@ -87,7 +87,15 @@ export class SallaBottomAlert {
|
|
|
87
87
|
h("div", { class: "s-bottom-alert-modal-content-footer" }, this.templateData.price && h("div", { class: "s-bottom-alert-modal-price-wrapper" }, h("div", null, this.storePrice), h("div", { class: "s-bottom-alert-modal-price-wrapper-amount" }, salla.money((_r = this.templateData) === null || _r === void 0 ? void 0 : _r.price))), h("salla-button", { color: 'primary', size: "medium", width: 'wide', href: (_s = this.templateData) === null || _s === void 0 ? void 0 : _s.link }, h("i", { innerHTML: shoppingBag }), this.buyTheTemplate)) : '')] : ''));
|
|
88
88
|
}
|
|
89
89
|
render() {
|
|
90
|
-
|
|
90
|
+
const hasTemplate = this.template && typeof this.template === 'object' && Object.keys(this.template).length > 0;
|
|
91
|
+
const developer = hasTemplate && this.template.developer;
|
|
92
|
+
const hasDeveloper = developer !== undefined;
|
|
93
|
+
const developerName = hasDeveloper && developer.name;
|
|
94
|
+
const developerUrl = hasDeveloper && developer.url;
|
|
95
|
+
return (h(Host, { class: "s-bottom-alert-wrapper" }, h("div", { class: "s-bottom-alert-content" }, h("div", { class: "s-bottom-alert-icon" }, this.icon ? h("i", { class: this.icon }) : h("i", { innerHTML: infoIcon })), h("div", { class: "s-bottom-alert-message" }, this.message ? (this.message) : hasTemplate ? (h("span", null, this.getDefaultMessage(), " ", h("a", { href: developerUrl ? developerUrl : "javascript:void(0);", class: {
|
|
96
|
+
"s-bottom-alert-message-highlight": true,
|
|
97
|
+
"s-bottom-alert-message-link": developerUrl,
|
|
98
|
+
}, target: developerUrl ? "_blank" : "", "aria-label": "Developer" }, developerName ? developerName : this.theDeveloper), " ", h("span", { class: "s-bottom-alert-message-splitter" }, "|"), " ", this.storePrice, ":", " ", h("span", { class: "s-bottom-alert-message-highlight" }, salla.money(this.template.price)))) : (this.defaultMessage)), this.type !== 'banner' && (h("div", { class: "s-bottom-alert-action" }, h("salla-button", { href: this.actionUrl, size: "medium", onClick: () => this.handleAction(), width: "normal" }, this.actionLabel || this.defaultActionLabel))), this.type === 'popup' && this.popup())));
|
|
91
99
|
}
|
|
92
100
|
static get is() { return "salla-bottom-alert"; }
|
|
93
101
|
static get originalStyleUrls() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-bottom-alert.js","sourceRoot":"","sources":["../../../src/components/salla-bottom-alert/salla-bottom-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAK7D,MAAM,OAAO,gBAAgB;EAC3B;mBAsB2B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;oBAC9B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;mBAC/B,KAAK;wBACJ,EAAE;0BACG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kDAAkD,CAAC;8BAC9D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC;yBAChD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;wBACjD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC;sBACjD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC;wBAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC;+BACxC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC;0BAC3D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC;iBAC1D,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC;gBAIH,OAAO;;;;;IArClE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;MACvB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CA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pB,CACG;QACL,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACxB,WAAK,KAAK,EAAC,uBAAuB;UAChC,oBACE,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,QAAQ,IAEb,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CACjD,CACX,CACP,CAAC,CAAC,CAAC,IAAI;QAEN,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAEzC,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Element, Prop, State } from '@stencil/core';\nimport infoIcon from '../../assets/svg/info.svg';\nimport shoppingBag from '../../assets/svg/shopping-bag2.svg';\n@Component({\n tag: 'salla-bottom-alert',\n styleUrl: 'salla-bottom-alert.scss',\n})\nexport class SallaBottomAlert {\n constructor() {\n salla.lang.onLoaded(() => {\n this.defaultMessage = salla.lang.get('common.elements.experimental_and_available_store');\n this.defaultActionLabel = salla.lang.get('common.elements.know_more');\n this.storeFeatures = salla.lang.get('common.elements.store_features');\n this.storeDetails = salla.lang.get('common.elements.store_details');\n this.templateInformation = salla.lang.get('common.elements.template_information');\n this.buyTheTemplate = salla.lang.get('common.elements.buy_the_template');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.store_price', 'سعر المتجر');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.store_price', 'Store Price');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.the_developer', 'المطور');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.the_developer', 'the developer');\n setTimeout(() => {\n this.storePrice = salla.lang.get('common.elements.store_price');\n this.theDeveloper = salla.lang.get('common.elements.the_developer');\n });\n });\n }\n\n private modal: HTMLSallaModalElement;\n @Element() host: HTMLElement;\n\n @State() storeId: string = salla.config.get('store.id')\n @State() template: any = salla.config.get('store.template')\n @State() loading: boolean = false\n @State() templateData: any = {}\n @State() defaultMessage: string = salla.lang.get('common.elements.experimental_and_available_store');\n @State() defaultActionLabel: string = salla.lang.get('common.elements.know_more');\n @State() storeFeatures: string = salla.lang.get('common.elements.store_features');\n @State() storeDetails: string = salla.lang.get('common.elements.store_details');\n @State() storePrice: string = salla.lang.get('common.elements.store_price');\n @State() theDeveloper: string = salla.lang.get('common.elements.the_developer');\n @State() templateInformation: string = salla.lang.get('common.elements.template_information');\n @State() buyTheTemplate: string = salla.lang.get('common.elements.buy_the_template');\n @State() isRtl: boolean = salla.config.get('theme.is_rtl', true);\n /**\n * Alert Type\n * */\n @Prop({ reflect: true }) type: 'link' | 'popup' | 'banner' = 'popup';\n\n /**\n * Alert Icon class from salla icons library - ex: sicon-user\n * */\n @Prop({ reflect: true }) icon: string;\n\n /**\n * Alert Message\n * */\n @Prop({ reflect: true }) message: string;\n\n /**\n * Button url - used when type is link\n * */\n @Prop({ reflect: true }) actionUrl: string;\n\n /**\n * Button label - used when type is link and popup\n * */\n @Prop({ reflect: true }) actionLabel: string;\n\n private open() {\n return this.modal.open()\n .then(() => this.handleTemplateRequest())\n }\n private getDefaultMessage(){\n return this.isRtl ? this.defaultMessage.substring(0, this.defaultMessage.lastIndexOf(\" \")) : this.defaultMessage.split(\" \").slice(0, -2).join(\" \");\n }\n private handleTemplateRequest() {\n if (Object.keys(this.templateData).length) {\n return;\n }\n this.modal.loading()\n return salla.api.request(`/store/template`, {}, 'get', { 'Store-Identifier': this.storeId })\n .then((res) => {\n this.modal.setTitle(this.templateInformation)\n this.templateData = res.data\n this.modal.stopLoading()\n })\n .catch(() => {\n this.modal.close()\n })\n }\n\n private handleAction() {\n if (this.type === 'link') {\n window.location.href = this.actionUrl;\n }\n\n if (this.type === 'popup') {\n this.open()\n }\n }\n\n popup() {\n return (\n <salla-modal class=\"s-bottom-alert-modal\" ref={modal => this.modal = modal} no-padding>\n {Object.keys(this.templateData).length ?\n [<div class=\"s-bottom-alert-modal-inner s-scrollbar\">\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length ? <div class=\"s-bottom-alert-modal-cover\">\n <img src={this.templateData?.screenshots[0]} alt=\"\" />\n </div> : ''}\n <div class={{\"s-bottom-alert-modal-content\": true, \"s-bottom-alert-modal-content-extra-padding\":this.templateData.price}} >\n {this.templateData?.description ?\n [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeDetails}\n </div>,\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>,\n <hr />\n ] : ''}\n {this.templateData?.features ? [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeFeatures}\n </div>,\n <div class=\"s-bottom-alert-modal-content-features\" innerHTML={this.templateData?.features}></div>\n ] : ''}\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length > 1 ?\n <salla-slider id='template-screenshots' type='carousel' class=\"s-bottom-alert-modal-content-screenshots\">\n <div slot='items'>\n {this.templateData?.screenshots.map((screenshot) => {\n return <div class=\"s-bottom-alert-modal-content-screenshot\">\n <img src={screenshot} alt=\"\" />\n </div>\n })}\n </div>\n </salla-slider>\n : ''}\n\n {this.templateData?.extra_info ?\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>\n : ''}\n </div>\n {this.templateData?.link ?\n <div class=\"s-bottom-alert-modal-content-footer\">\n {this.templateData.price && <div class=\"s-bottom-alert-modal-price-wrapper\">\n <div>\n {this.storePrice}\n </div>\n <div class=\"s-bottom-alert-modal-price-wrapper-amount\">\n {salla.money(this.templateData?.price)}\n </div>\n </div>}\n <salla-button\n color='primary'\n size=\"medium\"\n width='wide'\n href={this.templateData?.link}\n >\n <i innerHTML={shoppingBag}></i>\n {this.buyTheTemplate}\n </salla-button>\n </div> : ''\n }\n </div>] : ''\n }\n\n </salla-modal>\n )\n }\n render() {\n return (\n <Host class=\"s-bottom-alert-wrapper\">\n <div class=\"s-bottom-alert-content\">\n <div class=\"s-bottom-alert-icon\">\n {this.icon ? <i class={this.icon}></i> : <i innerHTML={infoIcon}></i>}\n </div>\n <div class=\"s-bottom-alert-message\">\n {this.message ? ( this.message ) : typeof this.template == 'object' && Object.keys(this.template).length ? (\n <span>\n {this.getDefaultMessage()}{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {this.template.developer && this.template.developer.name ? this.template.developer.name : this.theDeveloper}\n </span>{\" \"}\n <span class=\"s-bottom-alert-message-splitter\">|</span> {this.storePrice}:{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {salla.money(this.template.price)}\n </span>\n </span>\n ) : (\n this.defaultMessage\n )}\n </div>\n {this.type !== 'banner' ? (\n <div class=\"s-bottom-alert-action\">\n <salla-button\n href={this.actionUrl}\n size=\"medium\"\n onClick={() => this.handleAction()}\n width=\"normal\"\n >\n {this.actionLabel ? this.actionLabel : this.defaultActionLabel}\n </salla-button>\n </div>\n ) : null}\n {\n this.type === 'popup' ? this.popup() : null\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"salla-bottom-alert.js","sourceRoot":"","sources":["../../../src/components/salla-bottom-alert/salla-bottom-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAK7D,MAAM,OAAO,gBAAgB;EAC3B;mBAs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,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CACzB,WAAK,KAAK,EAAC,uBAAuB;UAChC,oBACE,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,QAAQ,IAEb,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,kBAAkB,CAC/B,CACX,CACP;QACA,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,CAClC,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGF","sourcesContent":["import { Component, Host, h, Element, Prop, State } from '@stencil/core';\nimport infoIcon from '../../assets/svg/info.svg';\nimport shoppingBag from '../../assets/svg/shopping-bag2.svg';\n@Component({\n tag: 'salla-bottom-alert',\n styleUrl: 'salla-bottom-alert.scss',\n})\nexport class SallaBottomAlert {\n constructor() {\n salla.lang.onLoaded(() => {\n this.defaultMessage = salla.lang.get('common.elements.experimental_and_available_store');\n this.defaultActionLabel = salla.lang.get('common.elements.know_more');\n this.storeFeatures = salla.lang.get('common.elements.store_features');\n this.storeDetails = salla.lang.get('common.elements.store_details');\n this.templateInformation = salla.lang.get('common.elements.template_information');\n this.buyTheTemplate = salla.lang.get('common.elements.buy_the_template');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.store_price', 'سعر المتجر');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.store_price', 'Store Price');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.the_developer', 'المطور');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.the_developer', 'the developer');\n setTimeout(() => {\n this.storePrice = salla.lang.get('common.elements.store_price');\n this.theDeveloper = salla.lang.get('common.elements.the_developer');\n });\n });\n }\n\n private modal: HTMLSallaModalElement;\n @Element() host: HTMLElement;\n\n @State() storeId: string = salla.config.get('store.id')\n @State() template: any = salla.config.get('store.template')\n @State() loading: boolean = false\n @State() templateData: any = {}\n @State() defaultMessage: string = salla.lang.get('common.elements.experimental_and_available_store');\n @State() defaultActionLabel: string = salla.lang.get('common.elements.know_more');\n @State() storeFeatures: string = salla.lang.get('common.elements.store_features');\n @State() storeDetails: string = salla.lang.get('common.elements.store_details');\n @State() storePrice: string = salla.lang.get('common.elements.store_price');\n @State() theDeveloper: string = salla.lang.get('common.elements.the_developer');\n @State() templateInformation: string = salla.lang.get('common.elements.template_information');\n @State() buyTheTemplate: string = salla.lang.get('common.elements.buy_the_template');\n @State() isRtl: boolean = salla.config.get('theme.is_rtl', true);\n /**\n * Alert Type\n * */\n @Prop({ reflect: true }) type: 'link' | 'popup' | 'banner' = 'popup';\n\n /**\n * Alert Icon class from salla icons library - ex: sicon-user\n * */\n @Prop({ reflect: true }) icon: string;\n\n /**\n * Alert Message\n * */\n @Prop({ reflect: true }) message: string;\n\n /**\n * Button url - used when type is link\n * */\n @Prop({ reflect: true }) actionUrl: string;\n\n /**\n * Button label - used when type is link and popup\n * */\n @Prop({ reflect: true }) actionLabel: string;\n\n private open() {\n return this.modal.open()\n .then(() => this.handleTemplateRequest())\n }\n private getDefaultMessage(){\n return this.isRtl ? this.defaultMessage.substring(0, this.defaultMessage.lastIndexOf(\" \")) : this.defaultMessage.split(\" \").slice(0, -2).join(\" \");\n }\n private handleTemplateRequest() {\n if (Object.keys(this.templateData).length) {\n return;\n }\n this.modal.loading()\n return salla.api.request(`/store/template`, {}, 'get', { 'Store-Identifier': this.storeId })\n .then((res) => {\n this.modal.setTitle(this.templateInformation)\n this.templateData = res.data\n this.modal.stopLoading()\n })\n .catch(() => {\n this.modal.close()\n })\n }\n\n private handleAction() {\n if (this.type === 'link') {\n window.location.href = this.actionUrl;\n }\n\n if (this.type === 'popup') {\n this.open()\n }\n }\n\n popup() {\n return (\n <salla-modal class=\"s-bottom-alert-modal\" ref={modal => this.modal = modal} no-padding>\n {Object.keys(this.templateData).length ?\n [<div class=\"s-bottom-alert-modal-inner s-scrollbar\">\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length ? <div class=\"s-bottom-alert-modal-cover\">\n <img src={this.templateData?.screenshots[0]} alt=\"\" />\n </div> : ''}\n <div class={{\"s-bottom-alert-modal-content\": true, \"s-bottom-alert-modal-content-extra-padding\":this.templateData.price}} >\n {this.templateData?.description ?\n [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeDetails}\n </div>,\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>,\n <hr />\n ] : ''}\n {this.templateData?.features ? [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeFeatures}\n </div>,\n <div class=\"s-bottom-alert-modal-content-features\" innerHTML={this.templateData?.features}></div>\n ] : ''}\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length > 1 ?\n <salla-slider id='template-screenshots' type='carousel' class=\"s-bottom-alert-modal-content-screenshots\">\n <div slot='items'>\n {this.templateData?.screenshots.map((screenshot) => {\n return <div class=\"s-bottom-alert-modal-content-screenshot\">\n <img src={screenshot} alt=\"\" />\n </div>\n })}\n </div>\n </salla-slider>\n : ''}\n\n {this.templateData?.extra_info ?\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>\n : ''}\n </div>\n {this.templateData?.link ?\n <div class=\"s-bottom-alert-modal-content-footer\">\n {this.templateData.price && <div class=\"s-bottom-alert-modal-price-wrapper\">\n <div>\n {this.storePrice}\n </div>\n <div class=\"s-bottom-alert-modal-price-wrapper-amount\">\n {salla.money(this.templateData?.price)}\n </div>\n </div>}\n <salla-button\n color='primary'\n size=\"medium\"\n width='wide'\n href={this.templateData?.link}\n >\n <i innerHTML={shoppingBag}></i>\n {this.buyTheTemplate}\n </salla-button>\n </div> : ''\n }\n </div>] : ''\n }\n\n </salla-modal>\n )\n }\n render() {\n const hasTemplate = this.template && typeof this.template === 'object' && Object.keys(this.template).length > 0;\n const developer = hasTemplate && this.template.developer;\n const hasDeveloper = developer !== undefined;\n const developerName = hasDeveloper && developer.name;\n const developerUrl = hasDeveloper && developer.url;\n \n return (\n <Host class=\"s-bottom-alert-wrapper\">\n <div class=\"s-bottom-alert-content\">\n <div class=\"s-bottom-alert-icon\">\n {this.icon ? <i class={this.icon}></i> : <i innerHTML={infoIcon}></i>}\n </div>\n <div class=\"s-bottom-alert-message\">\n {this.message ? (\n this.message\n ) : hasTemplate ? (\n <span>\n {this.getDefaultMessage()}{\" \"}\n <a\n href={developerUrl ? developerUrl : \"javascript:void(0);\"}\n class={{\n \"s-bottom-alert-message-highlight\": true,\n \"s-bottom-alert-message-link\": developerUrl,\n }}\n target={developerUrl ? \"_blank\" : \"\"}\n aria-label=\"Developer\"\n >\n {developerName ? developerName : this.theDeveloper}\n </a>{\" \"}\n <span class=\"s-bottom-alert-message-splitter\">|</span> {this.storePrice}:{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {salla.money(this.template.price)}\n </span>\n </span>\n ) : (\n this.defaultMessage\n )}\n </div>\n {this.type !== 'banner' && (\n <div class=\"s-bottom-alert-action\">\n <salla-button\n href={this.actionUrl}\n size=\"medium\"\n onClick={() => this.handleAction()}\n width=\"normal\"\n >\n {this.actionLabel || this.defaultActionLabel}\n </salla-button>\n </div>\n )}\n {this.type === 'popup' && this.popup()}\n </div>\n </Host>\n );\n }\n \n\n}\n"]}
|
|
@@ -70,18 +70,22 @@ export class SallaFiltersWidget {
|
|
|
70
70
|
if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {
|
|
71
71
|
return '';
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
const disabledAndSelectedOption = [];
|
|
74
|
+
const otherOptions = [];
|
|
75
|
+
option.values.forEach((filterOption, index) => {
|
|
75
76
|
let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const isDisabledAndSelected = this.page.slug == 'product.index' && Number(filterOption.key) == this.page.id;
|
|
78
|
+
const label = (h("label", { class: "s-filters-label", htmlFor: `${option.key}-option-${index}`, style: { "opacity": isDisabledAndSelected ? "0.6" : "1" } }, h("input", { id: `${option.key}-option-${index}`, name: isDisabledAndSelected ? "current-category" : option.key, type: isDisabledAndSelected ? "checkbox" : option.inputType, checked: isDisabledAndSelected || this.isSelectedOption(option, value), disabled: isDisabledAndSelected, class: `s-filters-${isDisabledAndSelected ? "checkbox" : option.inputType}`, onChange: e => !isDisabledAndSelected ? this.changed.emit({ event: e, option: option, value: value }) : null }), this.getOptionLabel(option, filterOption)));
|
|
79
|
+
if (isDisabledAndSelected) {
|
|
80
|
+
disabledAndSelectedOption.unshift(label); // Add to the beginning of the disabledAndSelectedOption array
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
otherOptions.push(label); // Add to the end of the otherOptions array
|
|
84
|
+
}
|
|
79
85
|
});
|
|
86
|
+
return disabledAndSelectedOption.concat(otherOptions);
|
|
80
87
|
}
|
|
81
88
|
isSelectedOption(option, value) {
|
|
82
|
-
if (this.page.slug == 'product.index' && this.option.key == 'category_id') {
|
|
83
|
-
return this.page.id == value;
|
|
84
|
-
}
|
|
85
89
|
if (!this.filtersData || !this.filtersData[option.key]) {
|
|
86
90
|
return false;
|
|
87
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-filters-widget.js","sourceRoot":"","sources":["../../../src/components/salla-filters-widget/salla-filters-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["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"]}
|
|
1
|
+
{"version":3,"file":"salla-filters-widget.js","sourceRoot":"","sources":["../../../src/components/salla-filters-widget/salla-filters-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAU,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,6BAA6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AE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EACxE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,EACrC,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAEzB;QACL,IAAI,CAAC,YAAY;UAChB,SAAG,KAAK,EAAC,uBAAuB,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAK,CAEhG,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["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"]}
|
|
@@ -16,6 +16,8 @@ export class SallaPriceRange {
|
|
|
16
16
|
this.lessThanLabel = "أقل من";
|
|
17
17
|
this.toLabel = "الى";
|
|
18
18
|
this.fromLabel = "من";
|
|
19
|
+
this.typing = false;
|
|
20
|
+
this.debounce = setTimeout(() => '', 1000);
|
|
19
21
|
}
|
|
20
22
|
connectedCallback() {
|
|
21
23
|
var _a;
|
|
@@ -72,26 +74,37 @@ export class SallaPriceRange {
|
|
|
72
74
|
handleMinMaxPrice(event, value) {
|
|
73
75
|
//todo:: cover when from is star
|
|
74
76
|
this.minPrice = value.from;
|
|
75
|
-
this.maxPrice = value.to != '*' ? value.to :
|
|
77
|
+
this.maxPrice = value.to != '*' ? value.to : "";
|
|
76
78
|
this.changedEventHandler(event);
|
|
77
79
|
}
|
|
78
80
|
async changedEventHandler(event, isMin = false) {
|
|
81
|
+
this.typing = true;
|
|
79
82
|
salla.helpers.inputDigitsOnly(event.target);
|
|
80
|
-
let value = event ? event.target.value * 1 :
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
let value = event ? event.target.value * 1 : "";
|
|
84
|
+
clearTimeout(this.debounce);
|
|
85
|
+
this.debounce = setTimeout(() => {
|
|
86
|
+
this.typing = false;
|
|
87
|
+
if (isMin) {
|
|
88
|
+
if (!this.maxPrice && value) {
|
|
89
|
+
this.maxPrice = '';
|
|
90
|
+
}
|
|
91
|
+
this.minInputValidation(value);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if (!this.minPrice && value) {
|
|
95
|
+
this.minPrice = 0;
|
|
96
|
+
}
|
|
97
|
+
this.maxInputValidation(value);
|
|
98
|
+
}
|
|
99
|
+
this.isReady && this.changed.emit({
|
|
100
|
+
event: event,
|
|
101
|
+
option: this.option,
|
|
102
|
+
value: { max: this.maxPrice, min: this.minPrice }
|
|
103
|
+
});
|
|
104
|
+
}, 1000);
|
|
92
105
|
}
|
|
93
106
|
minInputValidation(value) {
|
|
94
|
-
if (value && (value > this.max || value > this.maxPrice)) {
|
|
107
|
+
if (value && (value > this.max || (this.maxPrice && value > this.maxPrice))) {
|
|
95
108
|
// this.minPrice = this.maxPrice;
|
|
96
109
|
return;
|
|
97
110
|
}
|
|
@@ -104,7 +117,7 @@ export class SallaPriceRange {
|
|
|
104
117
|
}
|
|
105
118
|
}
|
|
106
119
|
maxInputValidation(value) {
|
|
107
|
-
if (value && (value < this.min || value < this.minPrice)) {
|
|
120
|
+
if (value && (value < this.min || (this.minPrice && value < this.minPrice))) {
|
|
108
121
|
// this.maxPrice = this.minPrice;
|
|
109
122
|
return;
|
|
110
123
|
}
|
|
@@ -232,7 +245,9 @@ export class SallaPriceRange {
|
|
|
232
245
|
"moreThanLabel": {},
|
|
233
246
|
"lessThanLabel": {},
|
|
234
247
|
"toLabel": {},
|
|
235
|
-
"fromLabel": {}
|
|
248
|
+
"fromLabel": {},
|
|
249
|
+
"typing": {},
|
|
250
|
+
"debounce": {}
|
|
236
251
|
};
|
|
237
252
|
}
|
|
238
253
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-price-range.js","sourceRoot":"","sources":["../../../src/components/salla-price-range/salla-price-range.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAO7E,MAAM,OAAO,eAAe;;IAsC1B,iBAAY,GAAuB,EAAE,CAAC;;;;;eAhBvB,CAAC;eACD,KAAK;;yBAEW,SAAS;yBACT,QAAQ;mBACd,KAAK;qBACH,IAAI;;EAa/B,iBAAiB;;IACf,IAAI,IAAI,CAAC,WAAW,KAAI,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,CAAA,EAAE;MAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;MAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;KAC5C;IACD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;MACvB,IAAI,CAAC,aAAa,GAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,2BAA2B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;MAC7F,IAAI,CAAC,aAAa,GAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,2BAA2B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;MAC7F,IAAI,CAAC,OAAO,GAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;MAC1E,IAAI,CAAC,SAAS,GAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAClF,CAAC,CAAC,CAAA;IAEF,iCAAiC;IACjC,IAAI,IA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AAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,EACzD,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,WAAW,EAAE,IAAI,CAAC,SAAS,EAC3B,KAAK,EAAC,4BAA4B,GAClC,CACE;YAEN,WAAK,KAAK,EAAC,yBAAyB,SAAS;YAC7C,WAAK,KAAK,EAAC,wBAAwB;cACjC,WAAK,KAAK,EAAC,wBAAwB;;gBAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAO;cAC3E,aAAO,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,GAAG,EAC3B,WAAW,EAAE,IAAI,CAAC,OAAO,EACzB,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,EAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EACnD,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,KAAK,EAAC,4BAA4B,sBAAkB,gBAAgB,GAAE,CACzE,CACF,CACF,CACF,CACD,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
|
|
1
|
+
{"version":3,"file":"salla-price-range.js","sourceRoot":"","sources":["../../../src/components/salla-price-range/salla-price-range.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAO/E,MAAM,OAAO,eAAe;;IAuC1B,iBAAY,GAAuB,EAAE,CAAC;;;;;eAjBvB,CAAC;eACD,KAAK;;yBAEa,SAAS;yBACT,QAAQ;mBACd,KAAK;qBACH,IAAI;kBACN,KAAK;oBACmB,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;;EAY7E,iBAAiB;;IACf,IAAI,IAAI,CAAC,WAAW,KAAI,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,CAAA,EAAE;MAC/C,IAAI,C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,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,EACzD,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,WAAW,EAAE,IAAI,CAAC,SAAS,EAC3B,KAAK,EAAC,4BAA4B,GAClC,CACE;YAEN,WAAK,KAAK,EAAC,yBAAyB,SAAS;YAC7C,WAAK,KAAK,EAAC,wBAAwB;cACjC,WAAK,KAAK,EAAC,wBAAwB;;gBAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAO;cAC3E,aAAO,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,GAAG,EAChC,WAAW,EAAE,IAAI,CAAC,OAAO,EACzB,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,EAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EACnD,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,KAAK,EAAC,4BAA4B,sBAAkB,gBAAgB,GAAG,CACrE,CACF,CACF,CACF,CACD,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
|