@salla.sa/twilight-components 2.12.54 → 2.12.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-add-product-button_41.cjs.entry.js +17 -7
  3. package/dist/cjs/salla-add-product-button_41.cjs.entry.js.map +1 -1
  4. package/dist/cjs/twilight.cjs.js +1 -1
  5. package/dist/collection/components/salla-product-card/salla-product-card.js +6 -6
  6. package/dist/collection/components/salla-product-card/salla-product-card.js.map +1 -1
  7. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +31 -1
  8. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js.map +1 -1
  9. package/dist/components/salla-product-card2.js +6 -6
  10. package/dist/components/salla-product-card2.js.map +1 -1
  11. package/dist/components/salla-quick-buy2.js +12 -1
  12. package/dist/components/salla-quick-buy2.js.map +1 -1
  13. package/dist/esm/loader.js +1 -1
  14. package/dist/esm/salla-add-product-button_41.entry.js +17 -7
  15. package/dist/esm/salla-add-product-button_41.entry.js.map +1 -1
  16. package/dist/esm/twilight.js +1 -1
  17. package/dist/esm-es5/loader.js +1 -1
  18. package/dist/esm-es5/loader.js.map +1 -1
  19. package/dist/esm-es5/salla-add-product-button_41.entry.js +2 -2
  20. package/dist/esm-es5/salla-add-product-button_41.entry.js.map +1 -1
  21. package/dist/esm-es5/twilight.js +1 -1
  22. package/dist/esm-es5/twilight.js.map +1 -1
  23. package/dist/twilight/{p-79705026.entry.js → p-9a9fe6f6.entry.js} +8 -8
  24. package/dist/twilight/p-9a9fe6f6.entry.js.map +1 -0
  25. package/dist/twilight/p-9f2e0944.system.js +1 -1
  26. package/dist/twilight/p-9f2e0944.system.js.map +1 -1
  27. package/dist/twilight/{p-e90369c0.system.entry.js → p-d6f3ac98.system.entry.js} +2 -2
  28. package/dist/twilight/p-d6f3ac98.system.entry.js.map +1 -0
  29. package/dist/twilight/twilight.esm.js +1 -1
  30. package/dist/twilight/twilight.esm.js.map +1 -1
  31. package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +6 -0
  32. package/dist/types/components.d.ts +10 -0
  33. package/package.json +2 -2
  34. package/dist/twilight/p-79705026.entry.js.map +0 -1
  35. package/dist/twilight/p-e90369c0.system.entry.js.map +0 -1
  36. package/dist/types/global.d.ts +0 -17
@@ -23,7 +23,7 @@ const patchBrowser = () => {
23
23
 
24
24
  patchBrowser().then(options => {
25
25
  appGlobals.globalScripts();
26
- return index.bootstrapLazy(JSON.parse("[[\"salla-add-product-button_41.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]}],[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],\"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],\"loading\":[32],\"templateData\":[32],\"defaultMessage\":[32],\"defaultActionLabel\":[32],\"storeFeatures\":[32],\"storeDetails\":[32],\"templateInformation\":[32],\"buyTheTemplate\":[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-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],\"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]}],[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-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]}],[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],\"isProfileVerify\":[32],\"getCode\":[64],\"open\":[64]}],[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-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]}],[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\"]]],[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\"],\"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]}],[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-list-tile\",{\"href\":[1],\"target\":[1]}],[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]}],[4,\"salla-placeholder\",{\"icon\":[1],\"alignment\":[1],\"iconSize\":[1,\"icon-size\"],\"translationLoaded\":[32]}],[0,\"salla-skeleton\",{\"type\":[1],\"width\":[1],\"height\":[1]}],[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],\"load\":[64],\"stop\":[64],\"setText\":[64],\"disable\":[64],\"enable\":[64]}]]],[\"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-comment-form.cjs\",[[0,\"salla-comment-form\",{\"type\":[1537],\"showAvatar\":[4,\"show-avatar\"],\"itemId\":[1544,\"item-id\"],\"placeholder\":[32],\"submitText\":[32],\"canComment\":[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-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-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-filters-widget.cjs\",[[4,\"salla-filters-widget\",{\"withLoadMore\":[1028,\"with-load-more\"],\"filtersData\":[16],\"option\":[16],\"isOpen\":[32],\"isShowMore\":[32],\"showMoreLabel\":[32],\"showLessLabel\":[32],\"setWidgetHeight\":[64],\"reset\":[64],\"showMore\":[64],\"toggleWidget\":[64]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]]]"), options);
26
+ return index.bootstrapLazy(JSON.parse("[[\"salla-add-product-button_41.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]}],[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],\"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],\"loading\":[32],\"templateData\":[32],\"defaultMessage\":[32],\"defaultActionLabel\":[32],\"storeFeatures\":[32],\"storeDetails\":[32],\"templateInformation\":[32],\"buyTheTemplate\":[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-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],\"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]}],[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-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]}],[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],\"isProfileVerify\":[32],\"getCode\":[64],\"open\":[64]}],[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-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]}],[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\"]]],[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]}],[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-list-tile\",{\"href\":[1],\"target\":[1]}],[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]}],[4,\"salla-placeholder\",{\"icon\":[1],\"alignment\":[1],\"iconSize\":[1,\"icon-size\"],\"translationLoaded\":[32]}],[0,\"salla-skeleton\",{\"type\":[1],\"width\":[1],\"height\":[1]}],[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],\"load\":[64],\"stop\":[64],\"setText\":[64],\"disable\":[64],\"enable\":[64]}]]],[\"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-comment-form.cjs\",[[0,\"salla-comment-form\",{\"type\":[1537],\"showAvatar\":[4,\"show-avatar\"],\"itemId\":[1544,\"item-id\"],\"placeholder\":[32],\"submitText\":[32],\"canComment\":[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-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-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-filters-widget.cjs\",[[4,\"salla-filters-widget\",{\"withLoadMore\":[1028,\"with-load-more\"],\"filtersData\":[16],\"option\":[16],\"isOpen\":[32],\"isShowMore\":[32],\"showMoreLabel\":[32],\"showLessLabel\":[32],\"setWidgetHeight\":[64],\"reset\":[64],\"showMore\":[64],\"toggleWidget\":[64]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]]]"), options);
27
27
  });
28
28
 
29
29
  exports.setNonce = index.setNonce;
@@ -98,7 +98,7 @@ export class SallaProductCard {
98
98
  return h("h4", { class: "s-product-card-price" }, this.getPriceFormat((_c = this.productData) === null || _c === void 0 ? void 0 : _c.price));
99
99
  }
100
100
  render() {
101
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
101
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
102
102
  const classes = {
103
103
  's-product-card-entry': true,
104
104
  's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,
@@ -119,16 +119,16 @@ export class SallaProductCard {
119
119
  : 'cover'} lazy`, src: this.placeholder, alt: (_h = (_g = this.productData) === null || _g === void 0 ? void 0 : _g.image) === null || _h === void 0 ? void 0 : _h.alt, "data-src": ((_k = (_j = this.productData) === null || _j === void 0 ? void 0 : _j.image) === null || _k === void 0 ? void 0 : _k.url) || ((_l = this.productData) === null || _l === void 0 ? void 0 : _l.thumbnail) }), !this.fullImage && !this.minimal ? this.getProductBadge() : ''), this.fullImage && h("a", Object.assign({}, hrefProp, { class: "s-product-card-overlay" })), !this.horizontal && !this.fullImage ?
120
120
  h("salla-button", { shape: "icon", fill: "none", color: "light", "aria-label": "Add or remove to wishlist", ref: el => this.wishlistBtn = el, class: "s-product-card-wishlist-btn animated", onClick: () => salla.wishlist.toggle(this.productData.id) }, h("span", { innerHTML: Heart })) : ''), h("div", { class: "s-product-card-content" }, this.isSpecial && ((_m = this.productData) === null || _m === void 0 ? void 0 : _m.quantity) ?
121
121
  h("div", { class: "s-product-card-content-pie", ref: pie => this.pie = pie }, h("span", null, h("b", null, salla.helpers.number((_o = this.productData) === null || _o === void 0 ? void 0 : _o.quantity)), this.remained), h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -1 36 34", class: "s-product-card-content-pie-svg" }, h("circle", { cx: "16", cy: "16", r: "15.9155", class: "s-product-card-content-pie-svg-base" }), h("circle", { cx: "16", cy: "16", r: "15.9155", class: "s-product-card-content-pie-svg-bar" })))
122
- : '', h("div", { class: { 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial } }, h("h3", { class: "s-product-card-content-title" }, h("a", { href: (_p = this.productData) === null || _p === void 0 ? void 0 : _p.url }, (_q = this.productData) === null || _q === void 0 ? void 0 : _q.name)), ((_r = this.productData) === null || _r === void 0 ? void 0 : _r.subtitle) && !this.minimal ?
123
- h("p", { class: "s-product-card-content-subtitle" }, (_s = this.productData) === null || _s === void 0 ? void 0 : _s.subtitle)
124
- : ''), ((_t = this.productData) === null || _t === void 0 ? void 0 : _t.donation) && !this.minimal && !this.fullImage ?
125
- [h("salla-progress-bar", { donation: (_u = this.productData) === null || _u === void 0 ? void 0 : _u.donation }), h("div", { class: "s-product-card-donation-input" }, ((_w = (_v = this.productData) === null || _v === void 0 ? void 0 : _v.donation) === null || _w === void 0 ? void 0 : _w.can_donate) ?
122
+ : '', h("div", { class: { 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial } }, h("h3", { class: "s-product-card-content-title" }, h("a", Object.assign({}, hrefProp), (_p = this.productData) === null || _p === void 0 ? void 0 : _p.name)), ((_q = this.productData) === null || _q === void 0 ? void 0 : _q.subtitle) && !this.minimal ?
123
+ h("p", { class: "s-product-card-content-subtitle" }, (_r = this.productData) === null || _r === void 0 ? void 0 : _r.subtitle)
124
+ : ''), ((_s = this.productData) === null || _s === void 0 ? void 0 : _s.donation) && !this.minimal && !this.fullImage ?
125
+ [h("salla-progress-bar", { donation: (_t = this.productData) === null || _t === void 0 ? void 0 : _t.donation }), h("div", { class: "s-product-card-donation-input" }, ((_v = (_u = this.productData) === null || _u === void 0 ? void 0 : _u.donation) === null || _v === void 0 ? void 0 : _v.can_donate) ?
126
126
  [h("label", { htmlFor: "donation-amount" }, this.donationAmount, " ", h("span", null, "*")), h("input", { type: "text", onInput: e => {
127
127
  salla.helpers.inputDigitsOnly(e.target);
128
128
  this.addBtn.donatingAmount = e.target.value;
129
129
  }, id: "donation-amount", name: "donating_amount", class: "s-form-control", placeholder: this.donationAmount })]
130
130
  : '')]
131
- : '', h("div", { class: { 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial } }, this.getProductPrice(), ((_y = (_x = this.productData) === null || _x === void 0 ? void 0 : _x.rating) === null || _y === void 0 ? void 0 : _y.stars) && !this.minimal ?
131
+ : '', h("div", { class: { 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial } }, this.getProductPrice(), ((_x = (_w = this.productData) === null || _w === void 0 ? void 0 : _w.rating) === null || _x === void 0 ? void 0 : _x.stars) && !this.minimal ?
132
132
  h("div", { class: "s-product-card-rating" }, h("span", { innerHTML: Star }), h("span", null, this.productData.rating.stars))
133
133
  : ''), this.isSpecial && this.productData.discount_ends
134
134
  ? h("salla-count-down", { date: this.formatDate(this.productData.discount_ends), "end-of-day": true, boxed: true, labeled: true })
@@ -1 +1 @@
1
- {"version":3,"file":"salla-product-card.js","sourceRoot":"","sources":["../../../src/components/salla-product-card/salla-product-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,KAAK,MAAM,4BAA4B,C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CACF,CACD,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;;IACd,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,KAAI,IAAI,CAAC,SAAS,EAAE;MAChD,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;MACrG,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport Heart from '../../assets/svg/heart.svg';\nimport Star from '../../assets/svg/star2.svg';\n\n/**\n * @slot add-to-cart-label - Add to cart label.\n */\n@Component({\n tag: 'salla-product-card',\n styleUrl: 'salla-product-card.scss',\n assetsDirs: ['assets']\n})\n\nexport class SallaProductCard {\n constructor() {\n // Store configs\n salla.onReady(() => {\n this.fitImageHeight = salla.config.get('store.settings.product.fit_type');\n salla.wishlist.event.onAdded((_res, id) => this.toggleFavoriteIcon(true, id));\n salla.wishlist.event.onRemoved((_res, id) => this.toggleFavoriteIcon(false, id));\n this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));\n });\n\n // Language\n salla.lang.onLoaded(() => {\n this.remained = salla.lang.get('pages.products.remained');\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.startingPrice = salla.lang.get('pages.products.starting_price');\n this.addToCart = salla.lang.get('pages.cart.add_to_cart');\n this.outOfStock = salla.lang.get('pages.products.out_of_stock');\n })\n\n // Parse product data\n if (this.product) {\n try {\n this.productData = typeof this.product == 'object' ? this.product : JSON.parse(this.product);\n return;\n } catch (e) {\n // TODO: Don't you think it's better not to render the component in this case?\n salla.log('Bad json passed via product prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n // State\n @State() productData: any;\n @State() fitImageHeight: boolean;\n @State() remained: string;\n @State() outOfStock: string;\n @State() donationAmount: string;\n @State() startingPrice: string;\n @State() addToCart: string;\n @State() placeholder: string;\n\n\n // Refs\n private pie: any;\n private wishlistBtn: HTMLSallaButtonElement;\n private addBtn: HTMLSallaAddProductButtonElement;\n\n // Props\n\n\n /**\n * Product information.\n */\n @Prop() product: string;\n\n /**\n * Horizontal card.\n */\n @Prop() horizontal: boolean;\n\n /**\n * Support shadow on hover.\n */\n @Prop() shadowOnHover: boolean;\n\n /**\n * Hide add to cart button.\n */\n @Prop() hideAddBtn: boolean;\n\n /**\n * Full image card.\n */\n @Prop() fullImage: boolean;\n\n /**\n * Minimal card.\n */\n @Prop() minimal: boolean;\n\n /**\n * Special card.\n */\n @Prop() isSpecial: boolean;\n\n /**\n * Show quantity.\n */\n @Prop() showQuantity: boolean;\n\n\n // Private Methods\n private initCircleBar() {\n let qty = this.productData.quantity,\n total = this.productData.quantity > 100 ? this.productData.quantity * 2 : 100,\n roundPercent = (qty / total) * 100,\n bar = this.pie.querySelector('.s-product-card-content-pie-svg-bar'),\n strokeDashOffsetValue = 100 - roundPercent;\n bar.style.strokeDashoffset = strokeDashOffsetValue;\n }\n\n private toggleFavoriteIcon(isAdded = true, id = null) {\n if (id && id !== this.productData.id) {\n return;\n }\n this.wishlistBtn?.classList.toggle('s-product-card-wishlist-added', isAdded);\n }\n\n private formatDate(date) {\n let d = new Date(date);\n return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;\n }\n\n private getProductBadge() {\n if (this.productData.promotion_title) {\n return <div class=\"s-product-card-promotion-title\">{this.productData.promotion_title}</div>\n }\n if (this.showQuantity && this.productData?.quantity) {\n return <div\n class=\"s-product-card-quantity\">{this.remained} {salla.helpers.number(this.productData?.quantity)}</div>\n }\n if (this.showQuantity && this.productData?.is_out_of_stock) {\n return <div class=\"s-product-card-out-badge\">{this.outOfStock}</div>\n }\n return '';\n\n }\n\n getPriceFormat(price) {\n if (!price || price == 0) {\n return salla.config.get('store.settings.product.show_price_as_dash')?'-':'';\n }\n\n return salla.money(price);\n }\n\n private getProductPrice() {\n if (this.productData.is_on_sale) {\n return <div class=\"s-product-card-sale-price\">\n <h4>{this.getPriceFormat(this.productData.sale_price)}</h4>\n <span>{this.getPriceFormat(this.productData?.regular_price)}</span>\n </div>;\n }\n if (this.productData.starting_price) {\n return <div class=\"s-product-card-starting-price\"><p>{this.startingPrice}</p>\n <h4> {this.getPriceFormat(this.productData?.starting_price)} </h4></div>\n }\n return <h4 class=\"s-product-card-price\">{this.getPriceFormat(this.productData?.price)}</h4>\n }\n\n render() {\n const classes = {\n 's-product-card-entry': true,\n 's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-horizontal': this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-fit-height': this.fitImageHeight && !this.isSpecial && !this.fullImage && !this.minimal,\n 's-product-card-special': this.isSpecial,\n 's-product-card-full-image': this.fullImage,\n 's-product-card-minimal': this.minimal,\n 's-product-card-donation': this.productData?.donation,\n 's-product-card-shadow': this.shadowOnHover,\n 's-product-card-out-of-stock': this.productData?.is_out_of_stock,\n };\n const hrefProp = this.productData?.url ? { href: this.productData.url } : {};\n return (\n <Host id={`product-${this.productData?.id}`} class={classes}>\n <div class={!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}>\n <a {...hrefProp}>\n <img class={`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)\n ? 'contain'\n : this.fitImageHeight\n ? this.fitImageHeight\n : 'cover'} lazy`}\n src={this.placeholder}\n alt={this.productData?.image?.alt}\n data-src={this.productData?.image?.url || this.productData?.thumbnail}\n />\n {!this.fullImage && !this.minimal ? this.getProductBadge() : ''}\n </a>\n {this.fullImage && <a {...hrefProp} class=\"s-product-card-overlay\" />}\n {!this.horizontal && !this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n aria-label=\"Add or remove to wishlist\"\n ref={el => this.wishlistBtn = el}\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}>\n <span innerHTML={Heart} />\n </salla-button> : ''\n }\n </div>\n <div class=\"s-product-card-content\">\n {this.isSpecial && this.productData?.quantity ?\n <div class=\"s-product-card-content-pie\" ref={pie => this.pie = pie}>\n <span>\n <b>{salla.helpers.number(this.productData?.quantity)}</b>\n {this.remained}\n </span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-2 -1 36 34\" class=\"s-product-card-content-pie-svg\">\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n : ''}\n\n <div class={{ 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n <h3 class=\"s-product-card-content-title\">\n <a href={this.productData?.url}>{this.productData?.name}</a>\n </h3>\n\n {this.productData?.subtitle && !this.minimal ?\n <p class=\"s-product-card-content-subtitle\">{this.productData?.subtitle}</p>\n : ''}\n </div>\n {this.productData?.donation && !this.minimal && !this.fullImage ?\n [<salla-progress-bar donation={this.productData?.donation} />,\n <div class=\"s-product-card-donation-input\">\n {this.productData?.donation?.can_donate ?\n [<label htmlFor=\"donation-amount\">{this.donationAmount} <span>*</span></label>,\n <input\n type=\"text\"\n onInput={e => {\n salla.helpers.inputDigitsOnly(e.target);\n this.addBtn.donatingAmount = (e.target as any).value;\n }}\n id=\"donation-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n placeholder={this.donationAmount} />]\n : ''}\n </div>]\n : ''}\n <div class={{ 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n {this.getProductPrice()}\n {this.productData?.rating?.stars && !this.minimal ?\n <div class=\"s-product-card-rating\">\n <span innerHTML={Star}/>\n <span>{this.productData.rating.stars}</span>\n </div>\n : ''}\n </div>\n\n {this.isSpecial && this.productData.discount_ends\n ? <salla-count-down date={this.formatDate(this.productData.discount_ends)} end-of-day={true} boxed={true}\n labeled={true} />\n : ''}\n\n\n {!this.hideAddBtn ?\n <div class=\"s-product-card-content-footer\">\n {/* @ts-ignore */}\n <salla-add-product-button fill=\"outline\" width=\"wide\"\n ref={el => this.addBtn = el}\n product-id={this.productData.id}\n product-status={this.productData.status}\n product-type={this.productData.type}>\n <slot name=\"add-to-cart-label\">{this.productData.add_to_cart_label}</slot>\n </salla-add-product-button>\n\n {this.horizontal || this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n ref={el => this.wishlistBtn = el}\n aria-label=\"Add or remove to wishlist\"\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}\n data-id=\"{{ product.id }}\">\n <span class=\"text-xl\" innerHTML={Heart} />\n </salla-button>\n : ''}\n </div>\n : ''}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));\n if (this.productData?.quantity && this.isSpecial) {\n this.initCircleBar();\n }\n\n if (!salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.productData.id)) {\n this.toggleFavoriteIcon();\n }\n }\n\n}\n"]}
1
+ {"version":3,"file":"salla-product-card.js","sourceRoot":"","sources":["../../../src/components/salla-product-card/salla-product-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,C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,CAC7B;cACf,CAAC,CAAC,EAAE,CACF;UACN,CAAC,CAAC,EAAE,CACF,CACD,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;;IACd,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,KAAI,IAAI,CAAC,SAAS,EAAE;MAChD,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;MACrG,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport Heart from '../../assets/svg/heart.svg';\nimport Star from '../../assets/svg/star2.svg';\n\n/**\n * @slot add-to-cart-label - Add to cart label.\n */\n@Component({\n tag: 'salla-product-card',\n styleUrl: 'salla-product-card.scss',\n assetsDirs: ['assets']\n})\n\nexport class SallaProductCard {\n constructor() {\n // Store configs\n salla.onReady(() => {\n this.fitImageHeight = salla.config.get('store.settings.product.fit_type');\n salla.wishlist.event.onAdded((_res, id) => this.toggleFavoriteIcon(true, id));\n salla.wishlist.event.onRemoved((_res, id) => this.toggleFavoriteIcon(false, id));\n this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));\n });\n\n // Language\n salla.lang.onLoaded(() => {\n this.remained = salla.lang.get('pages.products.remained');\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.startingPrice = salla.lang.get('pages.products.starting_price');\n this.addToCart = salla.lang.get('pages.cart.add_to_cart');\n this.outOfStock = salla.lang.get('pages.products.out_of_stock');\n })\n\n // Parse product data\n if (this.product) {\n try {\n this.productData = typeof this.product == 'object' ? this.product : JSON.parse(this.product);\n return;\n } catch (e) {\n // TODO: Don't you think it's better not to render the component in this case?\n salla.log('Bad json passed via product prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n // State\n @State() productData: any;\n @State() fitImageHeight: boolean;\n @State() remained: string;\n @State() outOfStock: string;\n @State() donationAmount: string;\n @State() startingPrice: string;\n @State() addToCart: string;\n @State() placeholder: string;\n\n\n // Refs\n private pie: any;\n private wishlistBtn: HTMLSallaButtonElement;\n private addBtn: HTMLSallaAddProductButtonElement;\n\n // Props\n\n\n /**\n * Product information.\n */\n @Prop() product: string;\n\n /**\n * Horizontal card.\n */\n @Prop() horizontal: boolean;\n\n /**\n * Support shadow on hover.\n */\n @Prop() shadowOnHover: boolean;\n\n /**\n * Hide add to cart button.\n */\n @Prop() hideAddBtn: boolean;\n\n /**\n * Full image card.\n */\n @Prop() fullImage: boolean;\n\n /**\n * Minimal card.\n */\n @Prop() minimal: boolean;\n\n /**\n * Special card.\n */\n @Prop() isSpecial: boolean;\n\n /**\n * Show quantity.\n */\n @Prop() showQuantity: boolean;\n\n\n // Private Methods\n private initCircleBar() {\n let qty = this.productData.quantity,\n total = this.productData.quantity > 100 ? this.productData.quantity * 2 : 100,\n roundPercent = (qty / total) * 100,\n bar = this.pie.querySelector('.s-product-card-content-pie-svg-bar'),\n strokeDashOffsetValue = 100 - roundPercent;\n bar.style.strokeDashoffset = strokeDashOffsetValue;\n }\n\n private toggleFavoriteIcon(isAdded = true, id = null) {\n if (id && id !== this.productData.id) {\n return;\n }\n this.wishlistBtn?.classList.toggle('s-product-card-wishlist-added', isAdded);\n }\n\n private formatDate(date) {\n let d = new Date(date);\n return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;\n }\n\n private getProductBadge() {\n if (this.productData.promotion_title) {\n return <div class=\"s-product-card-promotion-title\">{this.productData.promotion_title}</div>\n }\n if (this.showQuantity && this.productData?.quantity) {\n return <div\n class=\"s-product-card-quantity\">{this.remained} {salla.helpers.number(this.productData?.quantity)}</div>\n }\n if (this.showQuantity && this.productData?.is_out_of_stock) {\n return <div class=\"s-product-card-out-badge\">{this.outOfStock}</div>\n }\n return '';\n\n }\n\n getPriceFormat(price) {\n if (!price || price == 0) {\n return salla.config.get('store.settings.product.show_price_as_dash')?'-':'';\n }\n\n return salla.money(price);\n }\n\n private getProductPrice() {\n if (this.productData.is_on_sale) {\n return <div class=\"s-product-card-sale-price\">\n <h4>{this.getPriceFormat(this.productData.sale_price)}</h4>\n <span>{this.getPriceFormat(this.productData?.regular_price)}</span>\n </div>;\n }\n if (this.productData.starting_price) {\n return <div class=\"s-product-card-starting-price\"><p>{this.startingPrice}</p>\n <h4> {this.getPriceFormat(this.productData?.starting_price)} </h4></div>\n }\n return <h4 class=\"s-product-card-price\">{this.getPriceFormat(this.productData?.price)}</h4>\n }\n\n render() {\n const classes = {\n 's-product-card-entry': true,\n 's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-horizontal': this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-fit-height': this.fitImageHeight && !this.isSpecial && !this.fullImage && !this.minimal,\n 's-product-card-special': this.isSpecial,\n 's-product-card-full-image': this.fullImage,\n 's-product-card-minimal': this.minimal,\n 's-product-card-donation': this.productData?.donation,\n 's-product-card-shadow': this.shadowOnHover,\n 's-product-card-out-of-stock': this.productData?.is_out_of_stock,\n };\n const hrefProp = this.productData?.url ? { href: this.productData.url } : {};\n return (\n <Host id={`product-${this.productData?.id}`} class={classes}>\n <div class={!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}>\n <a {...hrefProp}>\n <img class={`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)\n ? 'contain'\n : this.fitImageHeight\n ? this.fitImageHeight\n : 'cover'} lazy`}\n src={this.placeholder}\n alt={this.productData?.image?.alt}\n data-src={this.productData?.image?.url || this.productData?.thumbnail}\n />\n {!this.fullImage && !this.minimal ? this.getProductBadge() : ''}\n </a>\n {this.fullImage && <a {...hrefProp} class=\"s-product-card-overlay\" />}\n {!this.horizontal && !this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n aria-label=\"Add or remove to wishlist\"\n ref={el => this.wishlistBtn = el}\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}>\n <span innerHTML={Heart} />\n </salla-button> : ''\n }\n </div>\n <div class=\"s-product-card-content\">\n {this.isSpecial && this.productData?.quantity ?\n <div class=\"s-product-card-content-pie\" ref={pie => this.pie = pie}>\n <span>\n <b>{salla.helpers.number(this.productData?.quantity)}</b>\n {this.remained}\n </span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-2 -1 36 34\" class=\"s-product-card-content-pie-svg\">\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n : ''}\n\n <div class={{ 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n <h3 class=\"s-product-card-content-title\">\n <a {...hrefProp}>{this.productData?.name}</a>\n </h3>\n\n {this.productData?.subtitle && !this.minimal ?\n <p class=\"s-product-card-content-subtitle\">{this.productData?.subtitle}</p>\n : ''}\n </div>\n {this.productData?.donation && !this.minimal && !this.fullImage ?\n [<salla-progress-bar donation={this.productData?.donation} />,\n <div class=\"s-product-card-donation-input\">\n {this.productData?.donation?.can_donate ?\n [<label htmlFor=\"donation-amount\">{this.donationAmount} <span>*</span></label>,\n <input\n type=\"text\"\n onInput={e => {\n salla.helpers.inputDigitsOnly(e.target);\n this.addBtn.donatingAmount = (e.target as any).value;\n }}\n id=\"donation-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n placeholder={this.donationAmount} />]\n : ''}\n </div>]\n : ''}\n <div class={{ 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n {this.getProductPrice()}\n {this.productData?.rating?.stars && !this.minimal ?\n <div class=\"s-product-card-rating\">\n <span innerHTML={Star}/>\n <span>{this.productData.rating.stars}</span>\n </div>\n : ''}\n </div>\n\n {this.isSpecial && this.productData.discount_ends\n ? <salla-count-down date={this.formatDate(this.productData.discount_ends)} end-of-day={true} boxed={true}\n labeled={true} />\n : ''}\n\n\n {!this.hideAddBtn ?\n <div class=\"s-product-card-content-footer\">\n {/* @ts-ignore */}\n <salla-add-product-button fill=\"outline\" width=\"wide\"\n ref={el => this.addBtn = el}\n product-id={this.productData.id}\n product-status={this.productData.status}\n product-type={this.productData.type}>\n <slot name=\"add-to-cart-label\">{this.productData.add_to_cart_label}</slot>\n </salla-add-product-button>\n\n {this.horizontal || this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n ref={el => this.wishlistBtn = el}\n aria-label=\"Add or remove to wishlist\"\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}\n data-id=\"{{ product.id }}\">\n <span class=\"text-xl\" innerHTML={Heart} />\n </salla-button>\n : ''}\n </div>\n : ''}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));\n if (this.productData?.quantity && this.isSpecial) {\n this.initCircleBar();\n }\n\n if (!salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.productData.id)) {\n this.toggleFavoriteIcon();\n }\n }\n\n}\n"]}
@@ -8,6 +8,7 @@ export class SallaQuickBuy {
8
8
  constructor() {
9
9
  this.type = 'buy';
10
10
  this.productId = undefined;
11
+ this.cartId = undefined;
11
12
  this.amount = undefined;
12
13
  this.currency = undefined;
13
14
  this.options = {};
@@ -65,6 +66,15 @@ export class SallaQuickBuy {
65
66
  validateMerchant: {
66
67
  url: salla.url.get('checkout/applepay/validate'),
67
68
  onSuccess: () => {
69
+ if (this.applePayOnly && !this.productId) { // the cart is not passes
70
+ if (!this.cartId) {
71
+ salla.logger.warn('🍏 Pay: trying to create applePay transaction without cartId/ProductId !');
72
+ return;
73
+ }
74
+ window.SallaApplePay.id = this.cartId;
75
+ salla.log('🍏 Pay: create checkout success: with id #' + this.cartId);
76
+ return;
77
+ }
68
78
  return salla.api.request('checkout/quick-purchase/' + this.productId, typeof data == 'object' ? data : undefined, 'post', {}).then(response => {
69
79
  var _a, _b;
70
80
  // if is redirect url returned for any reason, lets redirect the user to check out
@@ -78,7 +88,7 @@ export class SallaQuickBuy {
78
88
  salla.logger.warn('🍏 Pay: create checkout success: No id, or redirect');
79
89
  return response;
80
90
  }
81
- window.SallaApplePay.id = response.data.id || response.data.data.id;
91
+ window.SallaApplePay.id = response.data.id;
82
92
  salla.log('🍏 Pay: create checkout success: with id #' + window.SallaApplePay.id);
83
93
  });
84
94
  }
@@ -247,6 +257,26 @@ export class SallaQuickBuy {
247
257
  "attribute": "product-id",
248
258
  "reflect": false
249
259
  },
260
+ "cartId": {
261
+ "type": "string",
262
+ "mutable": true,
263
+ "complexType": {
264
+ "original": "string",
265
+ "resolved": "string",
266
+ "references": {}
267
+ },
268
+ "required": false,
269
+ "optional": false,
270
+ "docs": {
271
+ "tags": [{
272
+ "name": "type",
273
+ "text": "{string}"
274
+ }],
275
+ "text": "Cart ID, when you need to applePay for existed cart"
276
+ },
277
+ "attribute": "cart-id",
278
+ "reflect": false
279
+ },
250
280
  "amount": {
251
281
  "type": "number",
252
282
  "mutable": true,
@@ -1 +1 @@
1
- {"version":3,"file":"salla-quick-buy.js","sourceRoot":"","sources":["../../../src/components/salla-quick-buy/salla-quick-buy.tsx"],"names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B,EAC1B,KAAK,EAAC,SAAS,EACf,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EACZ,KAAK,EAAC,KAAK;UACvB,YAAM,SAAS,EAAE,UAAU,GAAG;UAC7B,IAAI,CAAC,QAAQ,CACD;UACf,CAAC,CAAC,EAAE,CAAC;EACT,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport FullWallet from '../../assets/svg/full-wallet.svg';\nimport \"@salla.sa/applepay/src/index\";\n\n@Component({\n tag: 'salla-quick-buy',\n styleUrl: 'salla-quick-buy.scss',\n})\nexport class SallaQuickBuy {\n constructor() {\n salla.lang.onLoaded(() => {\n this.quickBuy = salla.lang.get('pages.products.buy_now');\n });\n\n if (salla.config.isGuest()) {\n let eventName = \"salla-quick-buy::user.logged-in\"\n salla.api.auth.setAfterLoginEvent(eventName)\n salla.event.on(eventName, () => this.settlePayment())\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Button type.\n *\n * @type {string}\n * @default buy\n **/\n @Prop({ mutable: true }) type: 'plain' | 'buy' | 'donate' | 'book' | 'pay' | 'order' = 'buy';\n\n /**\n * Product ID.\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) productId: string;\n\n /**\n * Product amount in base currency (SAR).\n *\n * @type {number}\n * @default 0\n **/\n @Prop({ reflect: true, mutable: true }) amount: number;\n\n /**\n * base currency\n *\n * @type {string}\n * @default SAR\n */\n @Prop({ mutable: true }) currency: string;\n\n /**\n * Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id=\"X\"]')\n *\n * @type {object}\n * @default {}\n */\n @Prop() options = {};\n\n /**\n * To be passed to purchaseNow request\n * @type {boolean}\n **/\n @Prop({mutable: true}) isRequireShipping: boolean;\n \n /**\n * Show Apple Pay only\n * @type {boolean}\n **/\n @Prop({mutable: true}) applePayOnly: boolean;\n\n @State() isApplePayActive: boolean;\n\n @State() quickBuy: string = salla.lang.get('pages.products.buy_now');\n\n private async quickBuyHandler() {\n if (salla.config.isGuest()) {\n // todo (low) :: find a way to re-fire the method after success\n return salla.auth.event.dispatch('login::open', { withoutReload: true });\n }\n await this.settlePayment()\n }\n\n private async settlePayment() {\n\n let optionsElement = document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as HTMLSallaProductOptionsElement;\n //make sure all the required options are selected\n if (optionsElement && !await optionsElement.reportValidity()) {\n return salla.error(salla.lang.get('common.messages.required_fields'));\n }\n\n //use this way to get quantity too\n let data = (this.host as any).getElementSallaData();\n\n // if the store doesn't have Apple Pay , just create a cart and then redirect to check out page\n if (!this.isApplePayActive) {\n // return salla.product.buyNow(this.productId, data);\n return salla.api.request('checkout/quick-purchase/' + this.productId, data, 'post')\n .then(resp => {\n if (resp.data.redirect) {\n window.location.href = resp.data.redirect;\n }\n return resp;\n });\n }\n data.is_applepay = true;\n\n if ('append' in data) {\n data.append('is_applepay', true);\n }\n\n // noinspection TypeScriptValidateJSTypes\n salla.event.dispatch('payments::apple-pay.start-transaction', {\n amount: this.amount, // 1000\n currency: this.currency || 'SAR', // SAR\n requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,\n shippingMethods: this.isRequireShipping ? [] : null,\n supportedNetworks: salla.config.get('store.settings.buy_now.networks'),\n supportedCountries: salla.config.get('store.settings.buy_now.countries'),\n validateMerchant: {\n url: salla.url.get('checkout/applepay/validate'),\n onSuccess: () => {\n return salla.api.request('checkout/quick-purchase/' + this.productId, typeof data == 'object' ? data : undefined, 'post', {}).then(response => {\n\n // if is redirect url returned for any reason, lets redirect the user to check out\n if (response?.data?.redirect) {\n salla.log('🍏 Pay: create checkout success: redirect exits, go to checkout page');\n window.location.href = response.data.redirect.url;\n return response;\n }\n\n // the cart is not ready to complete apply pay session\n if (!response?.data?.id) {\n salla.logger.warn('🍏 Pay: create checkout success: No id, or redirect');\n return response;\n }\n\n window.SallaApplePay.id = response.data.id || response.data.data.id;\n\n salla.log('🍏 Pay: create checkout success: with id #' + window.SallaApplePay.id);\n });\n }\n },\n authorized: {\n // submit checkout route\n url: salla.url.get('checkout/{id}/payments/submit'),\n onFailed: (response) => {\n window.SallaApplePay.onCancel({}, response?.data?.error?.message || response?.data?.error?.code || salla.lang.get('pages.checkout.payment_failed'));\n },\n onSuccess: (response) => {\n window.location.href = response.redirect.url;\n salla.log('🍏 Pay: authorized Success:: redirect to thank you page, order placed');\n }\n },\n shippingMethodSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/shipping/details'),\n } : null,\n shippingContactSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/address/add'),\n } : null,\n oncouponcodechanged: {\n url: salla.url.get('checkout/{id}/coupons')\n },\n recalculateTotal: {\n url: salla.url.get('checkout/{id}/payments/recalculate')\n },\n onError: function (message) {\n salla.log(message);\n salla.notify.error(message);\n }\n });\n }\n\n componentWillLoad() {\n return new Promise((resolve, reject) => {\n salla.onReady(async () => {\n\n // if (!this.currency) {\n // this.currency = salla.config.get('user.currency_code');\n // }\n\n if (!this.productId && salla.config.get('page.id')) {\n this.productId = salla.config.get('page.id');\n }\n\n if (!this.applePayOnly && !this.productId) {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, the product id is missing')\n return reject()\n }\n\n /**\n * We should check the product if it's required shipping\n * in order for apple pay sdk to show the required Shipping Contact Fields\n * components..\n */\n if ((!this.amount || !this.isRequireShipping) && this.productId) {\n await salla.product.getDetails(this.productId, []).then((response) => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n this.isRequireShipping = response?.data?.is_require_shipping || false;\n }).catch((error) => {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error)\n return reject()\n })\n }\n\n\n\n if (this.type == 'donate') {\n salla.event.on('product-options::donation-changed', (data) => {\n if (String(data.id) !== String(this.productId)) {\n return;\n }\n\n this.amount = data.price;\n });\n if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.currency = response.data.base_currency_price.currency;\n });\n }\n } else if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n });\n }\n this.isApplePayActive = window.ApplePaySession?.canMakePayments()\n && salla.config.get('store.settings.payments')?.includes('apple_pay')\n && salla.config.get('store.settings.is_salla_gateway', false);\n\n let applePaySdk = document.getElementById('apple-pay-sdk');\n if (applePaySdk || !this.isApplePayActive) {\n salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'))\n resolve(true);\n return;\n }\n\n const script = document.createElement('script');\n script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';\n script.setAttribute('id', 'apple-pay-sdk');\n script.async = true;\n\n document.body.appendChild(script);\n\n resolve(true);\n })\n })\n }\n\n render() {\n return <Host>{this.quickBuyButton()}</Host>\n }\n\n private quickBuyButton() {\n return this.isApplePayActive\n ? <apple-pay-button locale={salla.config.get('user.language_code')}\n onClick={() => this.quickBuyHandler()}\n data-quick-purchase=\"applepay\"\n class=\"s-quick-buy-apple-pay\"\n data-is-applepay=\"1\"\n buttonstyle=\"black\"\n type={this.type} />\n :\n !this.applePayOnly ?<salla-button onClick={() => this.quickBuyHandler()}\n class=\"s-quick-buy-button\"\n color=\"primary\"\n fill=\"outline\"\n size=\"medium\"\n width=\"wide\"\n shape=\"btn\">\n <span innerHTML={FullWallet}/>\n {this.quickBuy}\n </salla-button>\n : '';\n }\n}\n"]}
1
+ {"version":3,"file":"salla-quick-buy.js","sourceRoot":"","sources":["../../../src/components/salla-quick-buy/salla-quick-buy.tsx"],"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AAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,yBACjB,UAAU,EAC9B,KAAK,EAAC,uBAAuB,sBACZ,GAAG,EACpB,WAAW,EAAC,OAAO,EACnB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI;MACrB,CAAC;QACD,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA,oBAAc,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,EACzD,KAAK,EAAC,oBAAoB,EAC1B,KAAK,EAAC,SAAS,EACf,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EACZ,KAAK,EAAC,KAAK;UACvB,YAAM,SAAS,EAAE,UAAU,GAAG;UAC7B,IAAI,CAAC,QAAQ,CACD;UACf,CAAC,CAAC,EAAE,CAAC;EACT,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport FullWallet from '../../assets/svg/full-wallet.svg';\nimport \"@salla.sa/applepay/src/index\";\n\n@Component({\n tag: 'salla-quick-buy',\n styleUrl: 'salla-quick-buy.scss',\n})\nexport class SallaQuickBuy {\n constructor() {\n salla.lang.onLoaded(() => {\n this.quickBuy = salla.lang.get('pages.products.buy_now');\n });\n\n if (salla.config.isGuest()) {\n let eventName = \"salla-quick-buy::user.logged-in\"\n salla.api.auth.setAfterLoginEvent(eventName)\n salla.event.on(eventName, () => this.settlePayment())\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Button type.\n *\n * @type {string}\n * @default buy\n **/\n @Prop({ mutable: true }) type: 'plain' | 'buy' | 'donate' | 'book' | 'pay' | 'order' = 'buy';\n\n /**\n * Product ID.\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) productId: string;\n\n /**\n * Cart ID, when you need to applePay for existed cart\n *\n * @type {string}\n **/\n @Prop({ mutable: true }) cartId: string;\n\n /**\n * Product amount in base currency (SAR).\n *\n * @type {number}\n * @default 0\n **/\n @Prop({ reflect: true, mutable: true }) amount: number;\n\n /**\n * base currency\n *\n * @type {string}\n * @default SAR\n */\n @Prop({ mutable: true }) currency: string;\n\n /**\n * Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id=\"X\"]')\n *\n * @type {object}\n * @default {}\n */\n @Prop() options = {};\n\n /**\n * To be passed to purchaseNow request\n * @type {boolean}\n **/\n @Prop({mutable: true}) isRequireShipping: boolean;\n \n /**\n * Show Apple Pay only\n * @type {boolean}\n **/\n @Prop({mutable: true}) applePayOnly: boolean;\n\n @State() isApplePayActive: boolean;\n\n @State() quickBuy: string = salla.lang.get('pages.products.buy_now');\n\n private async quickBuyHandler() {\n if (salla.config.isGuest()) {\n // todo (low) :: find a way to re-fire the method after success\n return salla.auth.event.dispatch('login::open', { withoutReload: true });\n }\n await this.settlePayment()\n }\n\n private async settlePayment() {\n\n let optionsElement = document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as HTMLSallaProductOptionsElement;\n //make sure all the required options are selected\n if (optionsElement && !await optionsElement.reportValidity()) {\n return salla.error(salla.lang.get('common.messages.required_fields'));\n }\n\n //use this way to get quantity too\n let data = (this.host as any).getElementSallaData();\n\n // if the store doesn't have Apple Pay , just create a cart and then redirect to check out page\n if (!this.isApplePayActive) {\n // return salla.product.buyNow(this.productId, data);\n return salla.api.request('checkout/quick-purchase/' + this.productId, data, 'post')\n .then(resp => {\n if (resp.data.redirect) {\n window.location.href = resp.data.redirect;\n }\n return resp;\n });\n }\n data.is_applepay = true;\n\n if ('append' in data) {\n data.append('is_applepay', true);\n }\n\n // noinspection TypeScriptValidateJSTypes\n salla.event.dispatch('payments::apple-pay.start-transaction', {\n amount: this.amount, // 1000\n currency: this.currency || 'SAR', // SAR\n requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,\n shippingMethods: this.isRequireShipping ? [] : null,\n supportedNetworks: salla.config.get('store.settings.buy_now.networks'),\n supportedCountries: salla.config.get('store.settings.buy_now.countries'),\n validateMerchant: {\n url: salla.url.get('checkout/applepay/validate'),\n onSuccess: () => {\n if (this.applePayOnly && !this.productId) { // the cart is not passes\n if (!this.cartId) {\n salla.logger.warn('🍏 Pay: trying to create applePay transaction without cartId/ProductId !');\n return;\n }\n window.SallaApplePay.id = this.cartId;\n salla.log('🍏 Pay: create checkout success: with id #' + this.cartId);\n return;\n\n }\n\n return salla.api.request('checkout/quick-purchase/' + this.productId, typeof data == 'object' ? data : undefined, 'post', {}).then(response => {\n\n // if is redirect url returned for any reason, lets redirect the user to check out\n if (response?.data?.redirect) {\n salla.log('🍏 Pay: create checkout success: redirect exits, go to checkout page');\n window.location.href = response.data.redirect.url;\n return response;\n }\n\n // the cart is not ready to complete apply pay session\n if (!response?.data?.id) {\n salla.logger.warn('🍏 Pay: create checkout success: No id, or redirect');\n return response;\n }\n\n window.SallaApplePay.id = response.data.id;\n\n salla.log('🍏 Pay: create checkout success: with id #' + window.SallaApplePay.id);\n });\n }\n },\n authorized: {\n // submit checkout route\n url: salla.url.get('checkout/{id}/payments/submit'),\n onFailed: (response) => {\n window.SallaApplePay.onCancel({}, response?.data?.error?.message || response?.data?.error?.code || salla.lang.get('pages.checkout.payment_failed'));\n },\n onSuccess: (response) => {\n window.location.href = response.redirect.url;\n salla.log('🍏 Pay: authorized Success:: redirect to thank you page, order placed');\n }\n },\n shippingMethodSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/shipping/details'),\n } : null,\n shippingContactSelected: this.isRequireShipping ? {\n url: salla.url.get('checkout/{id}/address/add'),\n } : null,\n oncouponcodechanged: {\n url: salla.url.get('checkout/{id}/coupons')\n },\n recalculateTotal: {\n url: salla.url.get('checkout/{id}/payments/recalculate')\n },\n onError: function (message) {\n salla.log(message);\n salla.notify.error(message);\n }\n });\n }\n\n componentWillLoad() {\n return new Promise((resolve, reject) => {\n salla.onReady(async () => {\n\n // if (!this.currency) {\n // this.currency = salla.config.get('user.currency_code');\n // }\n\n if (!this.productId && salla.config.get('page.id')) {\n this.productId = salla.config.get('page.id');\n }\n\n if (!this.applePayOnly && !this.productId) {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, the product id is missing')\n return reject()\n }\n\n /**\n * We should check the product if it's required shipping\n * in order for apple pay sdk to show the required Shipping Contact Fields\n * components..\n */\n if ((!this.amount || !this.isRequireShipping) && this.productId) {\n await salla.product.getDetails(this.productId, []).then((response) => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n this.isRequireShipping = response?.data?.is_require_shipping || false;\n }).catch((error) => {\n salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error)\n return reject()\n })\n }\n\n\n\n if (this.type == 'donate') {\n salla.event.on('product-options::donation-changed', (data) => {\n if (String(data.id) !== String(this.productId)) {\n return;\n }\n\n this.amount = data.price;\n });\n if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.currency = response.data.base_currency_price.currency;\n });\n }\n } else if (salla.url.is_page('product.single')) {\n salla.product.event?.onPriceUpdated(response => {\n this.amount = response.data.base_currency_price.amount;\n this.currency = response.data.base_currency_price.currency;\n });\n }\n this.isApplePayActive = window.ApplePaySession?.canMakePayments()\n && salla.config.get('store.settings.payments')?.includes('apple_pay')\n && salla.config.get('store.settings.is_salla_gateway', false);\n\n let applePaySdk = document.getElementById('apple-pay-sdk');\n if (applePaySdk || !this.isApplePayActive) {\n salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'))\n resolve(true);\n return;\n }\n\n const script = document.createElement('script');\n script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';\n script.setAttribute('id', 'apple-pay-sdk');\n script.async = true;\n\n document.body.appendChild(script);\n\n resolve(true);\n })\n })\n }\n\n render() {\n return <Host>{this.quickBuyButton()}</Host>\n }\n\n private quickBuyButton() {\n return this.isApplePayActive\n ? <apple-pay-button locale={salla.config.get('user.language_code')}\n onClick={() => this.quickBuyHandler()}\n data-quick-purchase=\"applepay\"\n class=\"s-quick-buy-apple-pay\"\n data-is-applepay=\"1\"\n buttonstyle=\"black\"\n type={this.type} />\n :\n !this.applePayOnly ?<salla-button onClick={() => this.quickBuyHandler()}\n class=\"s-quick-buy-button\"\n color=\"primary\"\n fill=\"outline\"\n size=\"medium\"\n width=\"wide\"\n shape=\"btn\">\n <span innerHTML={FullWallet}/>\n {this.quickBuy}\n </salla-button>\n : '';\n }\n}\n"]}
@@ -115,7 +115,7 @@ const SallaProductCard = /*@__PURE__*/ proxyCustomElement(class SallaProductCard
115
115
  return h("h4", { class: "s-product-card-price" }, this.getPriceFormat((_c = this.productData) === null || _c === void 0 ? void 0 : _c.price));
116
116
  }
117
117
  render() {
118
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
119
119
  const classes = {
120
120
  's-product-card-entry': true,
121
121
  's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,
@@ -136,16 +136,16 @@ const SallaProductCard = /*@__PURE__*/ proxyCustomElement(class SallaProductCard
136
136
  : 'cover'} lazy`, src: this.placeholder, alt: (_h = (_g = this.productData) === null || _g === void 0 ? void 0 : _g.image) === null || _h === void 0 ? void 0 : _h.alt, "data-src": ((_k = (_j = this.productData) === null || _j === void 0 ? void 0 : _j.image) === null || _k === void 0 ? void 0 : _k.url) || ((_l = this.productData) === null || _l === void 0 ? void 0 : _l.thumbnail) }), !this.fullImage && !this.minimal ? this.getProductBadge() : ''), this.fullImage && h("a", Object.assign({}, hrefProp, { class: "s-product-card-overlay" })), !this.horizontal && !this.fullImage ?
137
137
  h("salla-button", { shape: "icon", fill: "none", color: "light", "aria-label": "Add or remove to wishlist", ref: el => this.wishlistBtn = el, class: "s-product-card-wishlist-btn animated", onClick: () => salla.wishlist.toggle(this.productData.id) }, h("span", { innerHTML: Heart })) : ''), h("div", { class: "s-product-card-content" }, this.isSpecial && ((_m = this.productData) === null || _m === void 0 ? void 0 : _m.quantity) ?
138
138
  h("div", { class: "s-product-card-content-pie", ref: pie => this.pie = pie }, h("span", null, h("b", null, salla.helpers.number((_o = this.productData) === null || _o === void 0 ? void 0 : _o.quantity)), this.remained), h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -1 36 34", class: "s-product-card-content-pie-svg" }, h("circle", { cx: "16", cy: "16", r: "15.9155", class: "s-product-card-content-pie-svg-base" }), h("circle", { cx: "16", cy: "16", r: "15.9155", class: "s-product-card-content-pie-svg-bar" })))
139
- : '', h("div", { class: { 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial } }, h("h3", { class: "s-product-card-content-title" }, h("a", { href: (_p = this.productData) === null || _p === void 0 ? void 0 : _p.url }, (_q = this.productData) === null || _q === void 0 ? void 0 : _q.name)), ((_r = this.productData) === null || _r === void 0 ? void 0 : _r.subtitle) && !this.minimal ?
140
- h("p", { class: "s-product-card-content-subtitle" }, (_s = this.productData) === null || _s === void 0 ? void 0 : _s.subtitle)
141
- : ''), ((_t = this.productData) === null || _t === void 0 ? void 0 : _t.donation) && !this.minimal && !this.fullImage ?
142
- [h("salla-progress-bar", { donation: (_u = this.productData) === null || _u === void 0 ? void 0 : _u.donation }), h("div", { class: "s-product-card-donation-input" }, ((_w = (_v = this.productData) === null || _v === void 0 ? void 0 : _v.donation) === null || _w === void 0 ? void 0 : _w.can_donate) ?
139
+ : '', h("div", { class: { 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial } }, h("h3", { class: "s-product-card-content-title" }, h("a", Object.assign({}, hrefProp), (_p = this.productData) === null || _p === void 0 ? void 0 : _p.name)), ((_q = this.productData) === null || _q === void 0 ? void 0 : _q.subtitle) && !this.minimal ?
140
+ h("p", { class: "s-product-card-content-subtitle" }, (_r = this.productData) === null || _r === void 0 ? void 0 : _r.subtitle)
141
+ : ''), ((_s = this.productData) === null || _s === void 0 ? void 0 : _s.donation) && !this.minimal && !this.fullImage ?
142
+ [h("salla-progress-bar", { donation: (_t = this.productData) === null || _t === void 0 ? void 0 : _t.donation }), h("div", { class: "s-product-card-donation-input" }, ((_v = (_u = this.productData) === null || _u === void 0 ? void 0 : _u.donation) === null || _v === void 0 ? void 0 : _v.can_donate) ?
143
143
  [h("label", { htmlFor: "donation-amount" }, this.donationAmount, " ", h("span", null, "*")), h("input", { type: "text", onInput: e => {
144
144
  salla.helpers.inputDigitsOnly(e.target);
145
145
  this.addBtn.donatingAmount = e.target.value;
146
146
  }, id: "donation-amount", name: "donating_amount", class: "s-form-control", placeholder: this.donationAmount })]
147
147
  : '')]
148
- : '', h("div", { class: { 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial } }, this.getProductPrice(), ((_y = (_x = this.productData) === null || _x === void 0 ? void 0 : _x.rating) === null || _y === void 0 ? void 0 : _y.stars) && !this.minimal ?
148
+ : '', h("div", { class: { 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial } }, this.getProductPrice(), ((_x = (_w = this.productData) === null || _w === void 0 ? void 0 : _w.rating) === null || _x === void 0 ? void 0 : _x.stars) && !this.minimal ?
149
149
  h("div", { class: "s-product-card-rating" }, h("span", { innerHTML: Rate }), h("span", null, this.productData.rating.stars))
150
150
  : ''), this.isSpecial && this.productData.discount_ends
151
151
  ? h("salla-count-down", { date: this.formatDate(this.productData.discount_ends), "end-of-day": true, boxed: true, labeled: true })
@@ -1 +1 @@
1
- {"file":"salla-product-card2.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,M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IACnC,YAAM,IAAI,EAAC,mBAAmB,IAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAQ,CACjD,EAE1B,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS;QAChC,oBACE,KAAK,EAAC,MAAM,EACZ,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,OAAO,EACb,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,gBACrB,2BAA2B,EACtC,KAAK,EAAC,sCAAsC,EAC5C,OAAO,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,aACjD,kBAAkB,IAC1B,YAAM,KAAK,EAAC,SAAS,EAAC,SAAS,EAAE,KAAK,GAAI,CAC7B;UACb,EAAE,CACF;QACJ,EAAE,CACF,CACD,EACP;GACH;EAED,gBAAgB;;IACd,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,KAAI,IAAI,CAAC,SAAS,EAAE;MAChD,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;MACrG,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Star"],"sources":["src/components/salla-product-card/salla-product-card.scss?tag=salla-product-card","src/components/salla-product-card/salla-product-card.tsx"],"sourcesContent":[".s-product-card {\n &-entry {}\n\n &-image {\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ec1f\" !important;\n }\n }\n\n &-vertical {}\n\n &-horizontal {}\n\n &-fit-height {}\n\n &-special {}\n\n &-full-image {}\n\n &-minimal {}\n\n &-donation {}\n\n &-shadow {}\n\n &-out-of-stock {}\n\n &-wishlist-btn {}\n\n &-content {\n &-main {}\n\n &-sub {}\n\n &-footer {}\n\n &-title {}\n\n &-subtitle {}\n\n &-pie {\n &-svg {\n circle {\n transition: stroke-dashoffset 1s linear;\n -webkit-transition: stroke-dashoffset 1s linear;\n -moz-transition: stroke-dashoffset 1s linear;\n -ms-transition: stroke-dashoffset 1s linear;\n -o-transition: stroke-dashoffset 1s linear;\n stroke: #E8EDF2;\n stroke-width: 2px;\n stroke-linecap: round;\n fill: none\n }\n\n &-base {}\n\n &-bar {\n stroke: var(--color-primary) !important;\n stroke-dasharray: 100 100;\n stroke-dashoffset: 100\n }\n }\n }\n\n // for special card\n &-extra-padding {}\n }\n\n &-donation-input {}\n}\n","import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport Heart from '../../assets/svg/heart.svg';\nimport Star from '../../assets/svg/star2.svg';\n\n/**\n * @slot add-to-cart-label - Add to cart label.\n */\n@Component({\n tag: 'salla-product-card',\n styleUrl: 'salla-product-card.scss',\n assetsDirs: ['assets']\n})\n\nexport class SallaProductCard {\n constructor() {\n // Store configs\n salla.onReady(() => {\n this.fitImageHeight = salla.config.get('store.settings.product.fit_type');\n salla.wishlist.event.onAdded((_res, id) => this.toggleFavoriteIcon(true, id));\n salla.wishlist.event.onRemoved((_res, id) => this.toggleFavoriteIcon(false, id));\n this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));\n });\n\n // Language\n salla.lang.onLoaded(() => {\n this.remained = salla.lang.get('pages.products.remained');\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.startingPrice = salla.lang.get('pages.products.starting_price');\n this.addToCart = salla.lang.get('pages.cart.add_to_cart');\n this.outOfStock = salla.lang.get('pages.products.out_of_stock');\n })\n\n // Parse product data\n if (this.product) {\n try {\n this.productData = typeof this.product == 'object' ? this.product : JSON.parse(this.product);\n return;\n } catch (e) {\n // TODO: Don't you think it's better not to render the component in this case?\n salla.log('Bad json passed via product prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n // State\n @State() productData: any;\n @State() fitImageHeight: boolean;\n @State() remained: string;\n @State() outOfStock: string;\n @State() donationAmount: string;\n @State() startingPrice: string;\n @State() addToCart: string;\n @State() placeholder: string;\n\n\n // Refs\n private pie: any;\n private wishlistBtn: HTMLSallaButtonElement;\n private addBtn: HTMLSallaAddProductButtonElement;\n\n // Props\n\n\n /**\n * Product information.\n */\n @Prop() product: string;\n\n /**\n * Horizontal card.\n */\n @Prop() horizontal: boolean;\n\n /**\n * Support shadow on hover.\n */\n @Prop() shadowOnHover: boolean;\n\n /**\n * Hide add to cart button.\n */\n @Prop() hideAddBtn: boolean;\n\n /**\n * Full image card.\n */\n @Prop() fullImage: boolean;\n\n /**\n * Minimal card.\n */\n @Prop() minimal: boolean;\n\n /**\n * Special card.\n */\n @Prop() isSpecial: boolean;\n\n /**\n * Show quantity.\n */\n @Prop() showQuantity: boolean;\n\n\n // Private Methods\n private initCircleBar() {\n let qty = this.productData.quantity,\n total = this.productData.quantity > 100 ? this.productData.quantity * 2 : 100,\n roundPercent = (qty / total) * 100,\n bar = this.pie.querySelector('.s-product-card-content-pie-svg-bar'),\n strokeDashOffsetValue = 100 - roundPercent;\n bar.style.strokeDashoffset = strokeDashOffsetValue;\n }\n\n private toggleFavoriteIcon(isAdded = true, id = null) {\n if (id && id !== this.productData.id) {\n return;\n }\n this.wishlistBtn?.classList.toggle('s-product-card-wishlist-added', isAdded);\n }\n\n private formatDate(date) {\n let d = new Date(date);\n return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;\n }\n\n private getProductBadge() {\n if (this.productData.promotion_title) {\n return <div class=\"s-product-card-promotion-title\">{this.productData.promotion_title}</div>\n }\n if (this.showQuantity && this.productData?.quantity) {\n return <div\n class=\"s-product-card-quantity\">{this.remained} {salla.helpers.number(this.productData?.quantity)}</div>\n }\n if (this.showQuantity && this.productData?.is_out_of_stock) {\n return <div class=\"s-product-card-out-badge\">{this.outOfStock}</div>\n }\n return '';\n\n }\n\n getPriceFormat(price) {\n if (!price || price == 0) {\n return salla.config.get('store.settings.product.show_price_as_dash')?'-':'';\n }\n\n return salla.money(price);\n }\n\n private getProductPrice() {\n if (this.productData.is_on_sale) {\n return <div class=\"s-product-card-sale-price\">\n <h4>{this.getPriceFormat(this.productData.sale_price)}</h4>\n <span>{this.getPriceFormat(this.productData?.regular_price)}</span>\n </div>;\n }\n if (this.productData.starting_price) {\n return <div class=\"s-product-card-starting-price\"><p>{this.startingPrice}</p>\n <h4> {this.getPriceFormat(this.productData?.starting_price)} </h4></div>\n }\n return <h4 class=\"s-product-card-price\">{this.getPriceFormat(this.productData?.price)}</h4>\n }\n\n render() {\n const classes = {\n 's-product-card-entry': true,\n 's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-horizontal': this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-fit-height': this.fitImageHeight && !this.isSpecial && !this.fullImage && !this.minimal,\n 's-product-card-special': this.isSpecial,\n 's-product-card-full-image': this.fullImage,\n 's-product-card-minimal': this.minimal,\n 's-product-card-donation': this.productData?.donation,\n 's-product-card-shadow': this.shadowOnHover,\n 's-product-card-out-of-stock': this.productData?.is_out_of_stock,\n };\n const hrefProp = this.productData?.url ? { href: this.productData.url } : {};\n return (\n <Host id={`product-${this.productData?.id}`} class={classes}>\n <div class={!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}>\n <a {...hrefProp}>\n <img class={`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)\n ? 'contain'\n : this.fitImageHeight\n ? this.fitImageHeight\n : 'cover'} lazy`}\n src={this.placeholder}\n alt={this.productData?.image?.alt}\n data-src={this.productData?.image?.url || this.productData?.thumbnail}\n />\n {!this.fullImage && !this.minimal ? this.getProductBadge() : ''}\n </a>\n {this.fullImage && <a {...hrefProp} class=\"s-product-card-overlay\" />}\n {!this.horizontal && !this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n aria-label=\"Add or remove to wishlist\"\n ref={el => this.wishlistBtn = el}\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}>\n <span innerHTML={Heart} />\n </salla-button> : ''\n }\n </div>\n <div class=\"s-product-card-content\">\n {this.isSpecial && this.productData?.quantity ?\n <div class=\"s-product-card-content-pie\" ref={pie => this.pie = pie}>\n <span>\n <b>{salla.helpers.number(this.productData?.quantity)}</b>\n {this.remained}\n </span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-2 -1 36 34\" class=\"s-product-card-content-pie-svg\">\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n : ''}\n\n <div class={{ 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n <h3 class=\"s-product-card-content-title\">\n <a href={this.productData?.url}>{this.productData?.name}</a>\n </h3>\n\n {this.productData?.subtitle && !this.minimal ?\n <p class=\"s-product-card-content-subtitle\">{this.productData?.subtitle}</p>\n : ''}\n </div>\n {this.productData?.donation && !this.minimal && !this.fullImage ?\n [<salla-progress-bar donation={this.productData?.donation} />,\n <div class=\"s-product-card-donation-input\">\n {this.productData?.donation?.can_donate ?\n [<label htmlFor=\"donation-amount\">{this.donationAmount} <span>*</span></label>,\n <input\n type=\"text\"\n onInput={e => {\n salla.helpers.inputDigitsOnly(e.target);\n this.addBtn.donatingAmount = (e.target as any).value;\n }}\n id=\"donation-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n placeholder={this.donationAmount} />]\n : ''}\n </div>]\n : ''}\n <div class={{ 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n {this.getProductPrice()}\n {this.productData?.rating?.stars && !this.minimal ?\n <div class=\"s-product-card-rating\">\n <span innerHTML={Star}/>\n <span>{this.productData.rating.stars}</span>\n </div>\n : ''}\n </div>\n\n {this.isSpecial && this.productData.discount_ends\n ? <salla-count-down date={this.formatDate(this.productData.discount_ends)} end-of-day={true} boxed={true}\n labeled={true} />\n : ''}\n\n\n {!this.hideAddBtn ?\n <div class=\"s-product-card-content-footer\">\n {/* @ts-ignore */}\n <salla-add-product-button fill=\"outline\" width=\"wide\"\n ref={el => this.addBtn = el}\n product-id={this.productData.id}\n product-status={this.productData.status}\n product-type={this.productData.type}>\n <slot name=\"add-to-cart-label\">{this.productData.add_to_cart_label}</slot>\n </salla-add-product-button>\n\n {this.horizontal || this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n ref={el => this.wishlistBtn = el}\n aria-label=\"Add or remove to wishlist\"\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}\n data-id=\"{{ product.id }}\">\n <span class=\"text-xl\" innerHTML={Heart} />\n </salla-button>\n : ''}\n </div>\n : ''}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));\n if (this.productData?.quantity && this.isSpecial) {\n this.initCircleBar();\n }\n\n if (!salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.productData.id)) {\n this.toggleFavoriteIcon();\n }\n }\n\n}\n"],"version":3}
1
+ {"file":"salla-product-card2.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,mBAAmB,GAAG,ghBAAghB;;MCa/hB,gBAAgB;EAC3B;;;;;;;;;;;;;;;;;;;;IAEE,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,GA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,OAAO,EACb,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,gBACrB,2BAA2B,EACtC,KAAK,EAAC,sCAAsC,EAC5C,OAAO,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,aACjD,kBAAkB,IAC1B,YAAM,KAAK,EAAC,SAAS,EAAC,SAAS,EAAE,KAAK,GAAI,CAC7B;UACb,EAAE,CACF;QACJ,EAAE,CACF,CACD,EACP;GACH;EAED,gBAAgB;;IACd,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,KAAI,IAAI,CAAC,SAAS,EAAE;MAChD,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;MACrG,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Star"],"sources":["src/components/salla-product-card/salla-product-card.scss?tag=salla-product-card","src/components/salla-product-card/salla-product-card.tsx"],"sourcesContent":[".s-product-card {\n &-entry {}\n\n &-image {\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ec1f\" !important;\n }\n }\n\n &-vertical {}\n\n &-horizontal {}\n\n &-fit-height {}\n\n &-special {}\n\n &-full-image {}\n\n &-minimal {}\n\n &-donation {}\n\n &-shadow {}\n\n &-out-of-stock {}\n\n &-wishlist-btn {}\n\n &-content {\n &-main {}\n\n &-sub {}\n\n &-footer {}\n\n &-title {}\n\n &-subtitle {}\n\n &-pie {\n &-svg {\n circle {\n transition: stroke-dashoffset 1s linear;\n -webkit-transition: stroke-dashoffset 1s linear;\n -moz-transition: stroke-dashoffset 1s linear;\n -ms-transition: stroke-dashoffset 1s linear;\n -o-transition: stroke-dashoffset 1s linear;\n stroke: #E8EDF2;\n stroke-width: 2px;\n stroke-linecap: round;\n fill: none\n }\n\n &-base {}\n\n &-bar {\n stroke: var(--color-primary) !important;\n stroke-dasharray: 100 100;\n stroke-dashoffset: 100\n }\n }\n }\n\n // for special card\n &-extra-padding {}\n }\n\n &-donation-input {}\n}\n","import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport Heart from '../../assets/svg/heart.svg';\nimport Star from '../../assets/svg/star2.svg';\n\n/**\n * @slot add-to-cart-label - Add to cart label.\n */\n@Component({\n tag: 'salla-product-card',\n styleUrl: 'salla-product-card.scss',\n assetsDirs: ['assets']\n})\n\nexport class SallaProductCard {\n constructor() {\n // Store configs\n salla.onReady(() => {\n this.fitImageHeight = salla.config.get('store.settings.product.fit_type');\n salla.wishlist.event.onAdded((_res, id) => this.toggleFavoriteIcon(true, id));\n salla.wishlist.event.onRemoved((_res, id) => this.toggleFavoriteIcon(false, id));\n this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));\n });\n\n // Language\n salla.lang.onLoaded(() => {\n this.remained = salla.lang.get('pages.products.remained');\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.startingPrice = salla.lang.get('pages.products.starting_price');\n this.addToCart = salla.lang.get('pages.cart.add_to_cart');\n this.outOfStock = salla.lang.get('pages.products.out_of_stock');\n })\n\n // Parse product data\n if (this.product) {\n try {\n this.productData = typeof this.product == 'object' ? this.product : JSON.parse(this.product);\n return;\n } catch (e) {\n // TODO: Don't you think it's better not to render the component in this case?\n salla.log('Bad json passed via product prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n // State\n @State() productData: any;\n @State() fitImageHeight: boolean;\n @State() remained: string;\n @State() outOfStock: string;\n @State() donationAmount: string;\n @State() startingPrice: string;\n @State() addToCart: string;\n @State() placeholder: string;\n\n\n // Refs\n private pie: any;\n private wishlistBtn: HTMLSallaButtonElement;\n private addBtn: HTMLSallaAddProductButtonElement;\n\n // Props\n\n\n /**\n * Product information.\n */\n @Prop() product: string;\n\n /**\n * Horizontal card.\n */\n @Prop() horizontal: boolean;\n\n /**\n * Support shadow on hover.\n */\n @Prop() shadowOnHover: boolean;\n\n /**\n * Hide add to cart button.\n */\n @Prop() hideAddBtn: boolean;\n\n /**\n * Full image card.\n */\n @Prop() fullImage: boolean;\n\n /**\n * Minimal card.\n */\n @Prop() minimal: boolean;\n\n /**\n * Special card.\n */\n @Prop() isSpecial: boolean;\n\n /**\n * Show quantity.\n */\n @Prop() showQuantity: boolean;\n\n\n // Private Methods\n private initCircleBar() {\n let qty = this.productData.quantity,\n total = this.productData.quantity > 100 ? this.productData.quantity * 2 : 100,\n roundPercent = (qty / total) * 100,\n bar = this.pie.querySelector('.s-product-card-content-pie-svg-bar'),\n strokeDashOffsetValue = 100 - roundPercent;\n bar.style.strokeDashoffset = strokeDashOffsetValue;\n }\n\n private toggleFavoriteIcon(isAdded = true, id = null) {\n if (id && id !== this.productData.id) {\n return;\n }\n this.wishlistBtn?.classList.toggle('s-product-card-wishlist-added', isAdded);\n }\n\n private formatDate(date) {\n let d = new Date(date);\n return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;\n }\n\n private getProductBadge() {\n if (this.productData.promotion_title) {\n return <div class=\"s-product-card-promotion-title\">{this.productData.promotion_title}</div>\n }\n if (this.showQuantity && this.productData?.quantity) {\n return <div\n class=\"s-product-card-quantity\">{this.remained} {salla.helpers.number(this.productData?.quantity)}</div>\n }\n if (this.showQuantity && this.productData?.is_out_of_stock) {\n return <div class=\"s-product-card-out-badge\">{this.outOfStock}</div>\n }\n return '';\n\n }\n\n getPriceFormat(price) {\n if (!price || price == 0) {\n return salla.config.get('store.settings.product.show_price_as_dash')?'-':'';\n }\n\n return salla.money(price);\n }\n\n private getProductPrice() {\n if (this.productData.is_on_sale) {\n return <div class=\"s-product-card-sale-price\">\n <h4>{this.getPriceFormat(this.productData.sale_price)}</h4>\n <span>{this.getPriceFormat(this.productData?.regular_price)}</span>\n </div>;\n }\n if (this.productData.starting_price) {\n return <div class=\"s-product-card-starting-price\"><p>{this.startingPrice}</p>\n <h4> {this.getPriceFormat(this.productData?.starting_price)} </h4></div>\n }\n return <h4 class=\"s-product-card-price\">{this.getPriceFormat(this.productData?.price)}</h4>\n }\n\n render() {\n const classes = {\n 's-product-card-entry': true,\n 's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-horizontal': this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-fit-height': this.fitImageHeight && !this.isSpecial && !this.fullImage && !this.minimal,\n 's-product-card-special': this.isSpecial,\n 's-product-card-full-image': this.fullImage,\n 's-product-card-minimal': this.minimal,\n 's-product-card-donation': this.productData?.donation,\n 's-product-card-shadow': this.shadowOnHover,\n 's-product-card-out-of-stock': this.productData?.is_out_of_stock,\n };\n const hrefProp = this.productData?.url ? { href: this.productData.url } : {};\n return (\n <Host id={`product-${this.productData?.id}`} class={classes}>\n <div class={!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}>\n <a {...hrefProp}>\n <img class={`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)\n ? 'contain'\n : this.fitImageHeight\n ? this.fitImageHeight\n : 'cover'} lazy`}\n src={this.placeholder}\n alt={this.productData?.image?.alt}\n data-src={this.productData?.image?.url || this.productData?.thumbnail}\n />\n {!this.fullImage && !this.minimal ? this.getProductBadge() : ''}\n </a>\n {this.fullImage && <a {...hrefProp} class=\"s-product-card-overlay\" />}\n {!this.horizontal && !this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n aria-label=\"Add or remove to wishlist\"\n ref={el => this.wishlistBtn = el}\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}>\n <span innerHTML={Heart} />\n </salla-button> : ''\n }\n </div>\n <div class=\"s-product-card-content\">\n {this.isSpecial && this.productData?.quantity ?\n <div class=\"s-product-card-content-pie\" ref={pie => this.pie = pie}>\n <span>\n <b>{salla.helpers.number(this.productData?.quantity)}</b>\n {this.remained}\n </span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-2 -1 36 34\" class=\"s-product-card-content-pie-svg\">\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n : ''}\n\n <div class={{ 's-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n <h3 class=\"s-product-card-content-title\">\n <a {...hrefProp}>{this.productData?.name}</a>\n </h3>\n\n {this.productData?.subtitle && !this.minimal ?\n <p class=\"s-product-card-content-subtitle\">{this.productData?.subtitle}</p>\n : ''}\n </div>\n {this.productData?.donation && !this.minimal && !this.fullImage ?\n [<salla-progress-bar donation={this.productData?.donation} />,\n <div class=\"s-product-card-donation-input\">\n {this.productData?.donation?.can_donate ?\n [<label htmlFor=\"donation-amount\">{this.donationAmount} <span>*</span></label>,\n <input\n type=\"text\"\n onInput={e => {\n salla.helpers.inputDigitsOnly(e.target);\n this.addBtn.donatingAmount = (e.target as any).value;\n }}\n id=\"donation-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n placeholder={this.donationAmount} />]\n : ''}\n </div>]\n : ''}\n <div class={{ 's-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial }}>\n {this.getProductPrice()}\n {this.productData?.rating?.stars && !this.minimal ?\n <div class=\"s-product-card-rating\">\n <span innerHTML={Star}/>\n <span>{this.productData.rating.stars}</span>\n </div>\n : ''}\n </div>\n\n {this.isSpecial && this.productData.discount_ends\n ? <salla-count-down date={this.formatDate(this.productData.discount_ends)} end-of-day={true} boxed={true}\n labeled={true} />\n : ''}\n\n\n {!this.hideAddBtn ?\n <div class=\"s-product-card-content-footer\">\n {/* @ts-ignore */}\n <salla-add-product-button fill=\"outline\" width=\"wide\"\n ref={el => this.addBtn = el}\n product-id={this.productData.id}\n product-status={this.productData.status}\n product-type={this.productData.type}>\n <slot name=\"add-to-cart-label\">{this.productData.add_to_cart_label}</slot>\n </salla-add-product-button>\n\n {this.horizontal || this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n ref={el => this.wishlistBtn = el}\n aria-label=\"Add or remove to wishlist\"\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}\n data-id=\"{{ product.id }}\">\n <span class=\"text-xl\" innerHTML={Heart} />\n </salla-button>\n : ''}\n </div>\n : ''}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));\n if (this.productData?.quantity && this.isSpecial) {\n this.initCircleBar();\n }\n\n if (!salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.productData.id)) {\n this.toggleFavoriteIcon();\n }\n }\n\n}\n"],"version":3}