@salla.sa/twilight-components 2.14.485 → 2.14.487
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Helper-DvyEpCgx.js → Helper-B2B-kxAI.js} +7 -2
- package/dist/cjs/{filepond-B1h9ltVJ.js → filepond-D8YNIT7U.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-B4zD4xns.js → filepond-plugin-file-poster-DSZGbtH3.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-CIX5-X21.js → filepond-plugin-file-validate-size-CDPCt-vD.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-D1NcjxUw.js → filepond-plugin-file-validate-type-PPR9wk_f.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Bb7P11BN.js → filepond-plugin-image-edit-CbzNxXz5.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-C4HNrnSA.js → filepond-plugin-image-exif-orientation-CHOCkxIA.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-DeMAP_C9.js → filepond-plugin-image-preview-DPzPSwHT.js} +1 -1
- package/dist/cjs/{functions-COuh9Ohq.js → functions-BJ567SZR.js} +1 -1
- package/dist/cjs/{index-jbrJkd9L.js → index-AuVRM2C2.js} +1 -1
- package/dist/cjs/{index-8pwFZzoL.js → index-KEg0BIuu.js} +6 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +11 -11
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +349 -0
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +2 -2
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +15 -8
- package/dist/cjs/salla-filters.cjs.entry.js +101 -13
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +21 -5
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_3.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +21 -9
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-BOMQ9hTv.js → tracked-promise-DFl5fI3j.js} +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-DM7x_-2X.js → vanilla-picker-CUpM_-PS.js} +1 -1
- package/dist/collection/Helpers/Helper.js +7 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-cart-summary-card/salla-cart-summary-card.js +401 -0
- package/dist/collection/components/salla-filters/salla-filters.css +5 -0
- package/dist/collection/components/salla-filters/salla-filters.js +101 -11
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +13 -6
- package/dist/collection/components/salla-gifting/salla-gifting.js +21 -4
- package/dist/collection/components/salla-products-list/salla-products-list.js +19 -7
- package/dist/components/Helper.js +7 -2
- package/dist/components/index.js +2 -2
- package/dist/components/salla-cart-summary-card.d.ts +11 -0
- package/dist/components/salla-cart-summary-card.js +404 -0
- package/dist/components/salla-filters-widget2.js +13 -6
- package/dist/components/salla-filters.js +101 -11
- package/dist/components/salla-gifting.js +21 -4
- package/dist/components/salla-products-list2.js +19 -7
- package/dist/esm/{Helper-CD8d-Brd.js → Helper-BQ9mvrt9.js} +7 -2
- package/dist/esm/{filepond-DHzuRfQN.js → filepond-BsLighF8.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-BxdBxR7d.js → filepond-plugin-file-poster-Bm-5APBo.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-C-0L9g1L.js → filepond-plugin-file-validate-size-DkYobKMY.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-OyHjZUCW.js → filepond-plugin-file-validate-type-BXKbNDGH.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BIfGCYQ5.js → filepond-plugin-image-edit-B64dqBYZ.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DJlKxr63.js → filepond-plugin-image-exif-orientation-BelOzBrj.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-B2DpOs_r.js → filepond-plugin-image-preview-X67Ek3oE.js} +1 -1
- package/dist/esm/{functions-DT-OwuY-.js → functions-DobdGlrA.js} +1 -1
- package/dist/esm/{index-DJPd6DKq.js → index-DBMDFsFH.js} +6 -2
- package/dist/esm/{index-D449pxDB.js → index-yDeCyY3S.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +2 -2
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +11 -11
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +347 -0
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +2 -2
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +15 -8
- package/dist/esm/salla-filters.entry.js +101 -13
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +21 -5
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +2 -2
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_3.entry.js +2 -2
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +2 -2
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +21 -9
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-reward-action_4.entry.js +3 -3
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/{tracked-promise-CNnq4c_E.js → tracked-promise-6uJz7V9Q.js} +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-DQDhWp1B.js → vanilla-picker-Bw2Vk5YA.js} +1 -1
- package/dist/twilight/{p-07e93d60.entry.js → p-000022be.entry.js} +1 -1
- package/dist/twilight/{p-800e069d.entry.js → p-00fcfe8e.entry.js} +1 -1
- package/dist/twilight/{p-309914e6.entry.js → p-0412fe67.entry.js} +1 -1
- package/dist/twilight/{p-5cd703c2.entry.js → p-08dfa3c5.entry.js} +1 -1
- package/dist/twilight/{p-67ac0915.entry.js → p-0c219cad.entry.js} +1 -1
- package/dist/twilight/{p-2e1cf59c.entry.js → p-11f843fd.entry.js} +1 -1
- package/dist/twilight/p-130633cc.entry.js +4 -0
- package/dist/twilight/{p-3a103253.entry.js → p-1450bf80.entry.js} +1 -1
- package/dist/twilight/{p-1fc50a13.entry.js → p-14e936b0.entry.js} +1 -1
- package/dist/twilight/{p-e492ab39.entry.js → p-1547f282.entry.js} +1 -1
- package/dist/twilight/p-18efb27e.entry.js +4 -0
- package/dist/twilight/{p-2566c361.entry.js → p-18f264f9.entry.js} +1 -1
- package/dist/twilight/{p-78854c4a.entry.js → p-1b4fd0db.entry.js} +1 -1
- package/dist/twilight/{p-cbb75c0b.entry.js → p-1bb06699.entry.js} +1 -1
- package/dist/twilight/{p-74ba62ad.entry.js → p-1e418b8f.entry.js} +1 -1
- package/dist/twilight/p-24d268c7.entry.js +4 -0
- package/dist/twilight/{p-f60e5ac2.entry.js → p-29620c50.entry.js} +1 -1
- package/dist/twilight/{p-329f2f11.entry.js → p-2f48e8e1.entry.js} +1 -1
- package/dist/twilight/{p-7547a8c3.entry.js → p-37ced7ab.entry.js} +1 -1
- package/dist/twilight/{p-c88eb0de.entry.js → p-39a49ae9.entry.js} +1 -1
- package/dist/twilight/{p-dafb763f.entry.js → p-3a7f5c6e.entry.js} +1 -1
- package/dist/twilight/{p-b94fe237.entry.js → p-3f153e79.entry.js} +1 -1
- package/dist/twilight/{p-9f003164.entry.js → p-4336dce1.entry.js} +1 -1
- package/dist/twilight/{p-fe9451ac.entry.js → p-44f67d40.entry.js} +1 -1
- package/dist/twilight/{p-d21bdb22.entry.js → p-46294bef.entry.js} +1 -1
- package/dist/twilight/{p-7afc3b39.entry.js → p-4836c3eb.entry.js} +1 -1
- package/dist/twilight/{p-7dedb31c.entry.js → p-49275f85.entry.js} +1 -1
- package/dist/twilight/{p-ca0fa22b.entry.js → p-4a3ccff2.entry.js} +1 -1
- package/dist/twilight/{p-859f2c19.entry.js → p-4f8ec3a6.entry.js} +1 -1
- package/dist/twilight/{p-01fd381b.entry.js → p-5119fe5d.entry.js} +1 -1
- package/dist/twilight/{p-566bae1e.entry.js → p-519551ab.entry.js} +1 -1
- package/dist/twilight/{p-17f9907e.entry.js → p-51fbf1bb.entry.js} +1 -1
- package/dist/twilight/{p-1b9272d4.entry.js → p-52cab4a6.entry.js} +1 -1
- package/dist/twilight/{p-1620eaa3.entry.js → p-546b31a3.entry.js} +1 -1
- package/dist/twilight/{p-2794a82d.entry.js → p-57785b92.entry.js} +1 -1
- package/dist/twilight/{p-40256161.entry.js → p-5dfb7601.entry.js} +1 -1
- package/dist/twilight/{p-2270652d.entry.js → p-5e14fbf5.entry.js} +1 -1
- package/dist/twilight/{p-23a8870b.entry.js → p-60545378.entry.js} +1 -1
- package/dist/twilight/{p-adb4eed7.entry.js → p-61332673.entry.js} +1 -1
- package/dist/twilight/{p-5c7dd67e.entry.js → p-636e6994.entry.js} +1 -1
- package/dist/twilight/{p-f8eb9db2.entry.js → p-67ce35b0.entry.js} +1 -1
- package/dist/twilight/{p-9c52e63b.entry.js → p-6bdcd67d.entry.js} +1 -1
- package/dist/twilight/{p-6181acb5.entry.js → p-6e2b2072.entry.js} +1 -1
- package/dist/twilight/{p-d886da88.entry.js → p-76672fe3.entry.js} +1 -1
- package/dist/twilight/{p-26603c81.entry.js → p-79bff80a.entry.js} +1 -1
- package/dist/twilight/{p-445b3e07.entry.js → p-7a5894fb.entry.js} +1 -1
- package/dist/twilight/{p-74abfefb.entry.js → p-7b0f537a.entry.js} +1 -1
- package/dist/twilight/{p-a92549f6.entry.js → p-7bd7baa5.entry.js} +1 -1
- package/dist/twilight/{p-6e8a0f83.entry.js → p-8336df51.entry.js} +1 -1
- package/dist/twilight/{p-91884639.entry.js → p-8a7f48ce.entry.js} +1 -1
- package/dist/twilight/{p-005c08fe.entry.js → p-96779a0c.entry.js} +1 -1
- package/dist/twilight/{p-4a31a4dd.entry.js → p-967d356e.entry.js} +1 -1
- package/dist/twilight/{p-a20d0254.entry.js → p-9ab52d09.entry.js} +1 -1
- package/dist/twilight/{p-BG50tuBF.js → p-BR9zeoCF.js} +1 -1
- package/dist/twilight/{p-Cve96fFs.js → p-BTYXaopE.js} +1 -1
- package/dist/twilight/{p-tC9eMgA8.js → p-CDTIhPDr.js} +1 -1
- package/dist/twilight/{p-2xUZDJ04.js → p-CMW3pjiL.js} +1 -1
- package/dist/twilight/{p-DXqzsbXl.js → p-C_htBBK4.js} +1 -1
- package/dist/twilight/{p-BL8emH6B.js → p-C_vo3xPL.js} +1 -1
- package/dist/twilight/{p-BG-PTfCd.js → p-CcfoPQKG.js} +1 -1
- package/dist/twilight/{p-DJPd6DKq.js → p-DBMDFsFH.js} +1 -1
- package/dist/twilight/{p-C4k3wAWB.js → p-Dwu1e7SR.js} +1 -1
- package/dist/twilight/p-XnA1YTjA.js +4 -0
- package/dist/twilight/{p-af769e0a.entry.js → p-a767d9fe.entry.js} +1 -1
- package/dist/twilight/{p-7baf04d3.entry.js → p-ab404907.entry.js} +1 -1
- package/dist/twilight/{p-3c4b0b05.entry.js → p-acd8aa32.entry.js} +1 -1
- package/dist/twilight/{p-bff68f44.entry.js → p-ad1d3cdf.entry.js} +1 -1
- package/dist/twilight/{p-c06f0822.entry.js → p-b3b050e7.entry.js} +1 -1
- package/dist/twilight/{p-93e3a6b1.entry.js → p-b3b78bf5.entry.js} +1 -1
- package/dist/twilight/p-b3f26711.entry.js +4 -0
- package/dist/twilight/{p-985f8781.entry.js → p-b4f4e0b7.entry.js} +1 -1
- package/dist/twilight/{p-e056c218.entry.js → p-b7da726a.entry.js} +1 -1
- package/dist/twilight/{p-f13b397a.entry.js → p-b835777d.entry.js} +1 -1
- package/dist/twilight/{p-dac3e978.entry.js → p-c253f69c.entry.js} +1 -1
- package/dist/twilight/{p-2646c71c.entry.js → p-c46cf468.entry.js} +1 -1
- package/dist/twilight/{p-32eea65f.entry.js → p-c9608410.entry.js} +1 -1
- package/dist/twilight/{p-58e39fe9.entry.js → p-cc75ae11.entry.js} +1 -1
- package/dist/twilight/{p-48b68862.entry.js → p-ce0685d1.entry.js} +1 -1
- package/dist/twilight/{p-1b506134.entry.js → p-ce1bc4b0.entry.js} +1 -1
- package/dist/twilight/{p-302bc68d.entry.js → p-cf1b9798.entry.js} +1 -1
- package/dist/twilight/{p-17b0b92b.entry.js → p-cf96947a.entry.js} +1 -1
- package/dist/twilight/{p-0ade8936.entry.js → p-d01178f0.entry.js} +1 -1
- package/dist/twilight/{p-32ef12bb.entry.js → p-d3d2a114.entry.js} +1 -1
- package/dist/twilight/{p-69926ae5.entry.js → p-d8fb7f9a.entry.js} +1 -1
- package/dist/twilight/{p-5e39f770.entry.js → p-da827143.entry.js} +1 -1
- package/dist/twilight/{p-1dc4ab57.entry.js → p-ddd22625.entry.js} +1 -1
- package/dist/twilight/{p-cf17ece0.entry.js → p-de41e9b5.entry.js} +1 -1
- package/dist/twilight/p-e21a23d2.entry.js +4 -0
- package/dist/twilight/{p-6466fd9c.entry.js → p-e5022e8f.entry.js} +1 -1
- package/dist/twilight/{p-9248a9b8.entry.js → p-e84f7790.entry.js} +1 -1
- package/dist/twilight/{p-c2284ac3.entry.js → p-ef06457d.entry.js} +1 -1
- package/dist/twilight/{p-431b9986.entry.js → p-f12670a1.entry.js} +1 -1
- package/dist/twilight/{p-e625c6a1.entry.js → p-f267ac72.entry.js} +1 -1
- package/dist/twilight/{p-c1aa61bc.entry.js → p-f5d229a7.entry.js} +1 -1
- package/dist/twilight/{p-da010601.entry.js → p-f856fe4d.entry.js} +1 -1
- package/dist/twilight/{p-2d6f9f9e.entry.js → p-fa900f26.entry.js} +1 -1
- package/dist/twilight/{p-029c7342.entry.js → p-fd99de6e.entry.js} +1 -1
- package/dist/twilight/p-fdb0f6cc.entry.js +4 -0
- package/dist/twilight/{p-c31600a9.entry.js → p-ffd6ad27.entry.js} +1 -1
- package/dist/twilight/{p-Ce51TrKH.js → p-lQbFKmnv.js} +1 -1
- package/dist/twilight/{p-Bnff9Ut3.js → p-qj0-UBFk.js} +1 -1
- package/dist/twilight/{p-aMw12tPb.js → p-uiIu01tD.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-cart-summary-card/salla-cart-summary-card.d.ts +67 -0
- package/dist/types/components/salla-filters/salla-filters.d.ts +14 -0
- package/dist/types/components/salla-gifting/gift-schema.d.ts +2 -0
- package/dist/types/components/salla-gifting/salla-gifting.d.ts +8 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +1 -0
- package/dist/types/components.d.ts +37 -0
- package/package.json +5 -5
- package/dist/twilight/p-7f788909.entry.js +0 -4
- package/dist/twilight/p-80fc1a7b.entry.js +0 -4
- package/dist/twilight/p-83b8d7cf.entry.js +0 -4
- package/dist/twilight/p-8f672cef.entry.js +0 -4
- package/dist/twilight/p-C-3GuKNW.js +0 -4
- package/dist/twilight/p-f8ccc247.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as i,a as e,c as a}from"./p-DJPd6DKq.js";import{A as r,a as l}from"./p-Vqpj4CWE.js";import{S as o}from"./p-8Tsmrwno.js";import{C as n}from"./p-BV4kqbdL.js";import{H as d}from"./p-C-3GuKNW.js";import"./p-CgtvEd63.js";const h=class{constructor(t){s(this,t),this.collapsible=!0,this.bordered=!1,this.size="md",this.collapsed=!0,this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");this.collapsible&&s&&(s.setAttribute("collapsible","true"),s.setAttribute("collapsed",this.collapsed.toString()))}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");this.collapsible&&(this.host.setAttribute("data-collapsed",this.collapsed.toString()),s?.setAttribute("data-collapsed",this.collapsed.toString()))}render(){return t(i,{key:"1ea35adcb3558cad1c5e675ed7330e3859c31d20",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"596f47501e2080874cd28a304bc55b88409699cf"}))}get host(){return e(this)}};h.style="";const c=class{constructor(t){s(this,t),this.sessionStorageKey="breadcrumb_snapshot",this.itemSlot=this.host.querySelector('[slot="item"]')?.outerHTML||'<li class="s-breadcrumb-item"><a href={url}>{title}</a></li>',this.iconSlot=this.host.querySelector('[slot="icon"]')?.outerHTML}componentWillLoad(){return new Promise((s=>salla.onReady((()=>salla.lang.onLoaded(s))))).then((()=>{if(salla.url.is_page("index"))throw new Error("salla-breadcrumb:: breadcrumb not supported on home page")})).then((()=>{const s=salla.config.get("page");if("wishlist"===s?.slug)return void(this.breadcrumbs=[]);if(!salla.config.get("theme.settings.is_breadcrumbs_enabled",!0))throw new Error("salla-breadcrumb:: merchant disabled the feature");if(!s||!s.slug)return salla.logger.error('salla-breadcrumbs:: page object not existed on salla.config.get("page")!'),void(this.breadcrumbs=[]);let t=this.getSessionBreadcrumbs(),i=t[t.length-1];return"product.single"===s.slug&&t&&t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url?(t.push({title:s.title,url:s.url}),this.breadcrumbs=this.setBreadcrumbsFromArray(t),this.storeBreadcrumbSnapshot()):t&&t.length>0?this.isNewPage(s,t)?(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()):this.breadcrumbs=this.setBreadcrumbsFromArray(t):(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()),this.breadcrumbs?.length&&(this.breadcrumbs[this.breadcrumbs.length-1].is_last=!0),this.breadcrumbs})).catch((s=>{salla.logger.error("salla-breadcrumb:: unexpected error!",s),this.breadcrumbs=[]}))}getSessionBreadcrumbs(){return"search-bar"===new URLSearchParams(window.location.search).get("from")?[]:JSON.parse(sessionStorage.getItem(this.sessionStorageKey)||"[]")}isNewPage(s,t){const i=t[t.length-1];return i?.url!==s.url}setBreadcrumbsFromArray(s){return s.map(((t,i)=>({...t,is_last:i===s.length-1})))}sanitizeBreadcrumbTitle(s,t=1){if(!s.includes("|"))return s.trim();const i=s.split("|").map((s=>s.trim())).filter(Boolean);return i[t]||i[0]||s.replace(/\|/g,"").trim()}generateBreadcrumbs(s){let t=[];if("product.single"===s.slug){const t=this.getSessionBreadcrumbs(),i=t[t.length-1];if(t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url)return this.setBreadcrumbsFromArray([...t,{title:s.title,url:s.url}])}let i=s;for(;i;)i.title&&t.unshift({title:i.title,url:i.url}),i=i.parent;return s.slug.includes("customer")&&"customer.profile"!==s.slug&&t.unshift({title:salla.lang.get("common.titles.profile"),url:salla.url.get("profile")}),s.slug.includes("blog")&&t.unshift({title:salla.lang.get("blocks.footer.blog"),url:salla.url.get("blog")}),"brands.single"===s.slug&&t.unshift({title:salla.lang.get("common.titles.brands"),url:salla.url.get("brands")}),s.title||"loyalty"!==s.slug||t.unshift({title:salla.lang.get("common.titles.loyalty_program"),url:salla.url.get("loyalty")}),t.unshift({title:salla.lang.get("common.titles.home"),url:salla.url.get("")}),t}storeBreadcrumbSnapshot(){try{const s=salla.config.get("page");if("product.single"===s?.slug||"wishlist"===s?.slug)return;const t=[...this.breadcrumbs],i=t.length-1;i>=0&&(t[i].url=window.location.href);const e=JSON.stringify(t);sessionStorage.setItem(this.sessionStorageKey,e)}catch(s){salla.logger.error("salla-breadcrumb:: Failed to store breadcrumb snapshot in sessionStorage.",s)}}render(){if(this.breadcrumbs.length<=1)return salla.log("salla-breadcrumb:: There is no breadcrumbs!"),null;if("wishlist"===salla.config.get("page.slug"))return null;const s="product.single"===salla.config.get("page.slug");return[t("ol",{class:{"s-breadcrumb-wrapper":!0,"s-breadcrumb-dark":salla.url.is_page("loyalty"),"s-breadcrumb-primary-reverse":salla.config.get("page.slug").includes("customer")}},this.breadcrumbs.map((i=>{const e=s&&i.is_last?i.title:this.sanitizeBreadcrumbTitle(i.title),a=this.itemSlot.replace(/\{url\}/g,i.url).replace(/\{title\}/g,e);return[t("div",{class:"s-breadcrumb-slot",innerHTML:a}),this.getArrowDomForItem(i)]}))),t("script",{type:"application/ld+json",innerHTML:this.getJsonLd(s)})]}getJsonLd(s){const t=this.breadcrumbs.map(((t,i)=>{const e={"@type":"ListItem",position:i+1,name:s&&t.is_last?t.title:this.sanitizeBreadcrumbTitle(t.title)};return!t.is_last&&t.url&&(e.item=this.toAbsoluteUrl(t.url)),e}));return JSON.stringify({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:t}).replace(/</g,"\\u003c")}toAbsoluteUrl(s){try{return new URL(s,window.location.origin).href}catch{return s}}getArrowDomForItem(s){if(s.is_last)return"";let i=this.iconSlot||(salla.config.get("theme.is_rtl",!0)?r:l);return t("li",{class:"s-breadcrumb-arrow"},t("div",{class:{"s-breadcrumb-icon-slot":!0,"s-breadcrumb-default-icon":!this.iconSlot},innerHTML:i}))}componentDidRender(){this.host.querySelectorAll(".s-breadcrumb-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll(".s-breadcrumb-icon-slot.s-breadcrumb-default-icon").forEach((s=>s.replaceWith(s.querySelector("svg")))),this.host.querySelector('[slot="item"]')?.remove(),this.host.querySelector('[slot="icon"]')?.remove();let s=this.host.querySelectorAll(".s-breadcrumb-item")[this.breadcrumbs.length-1]?.querySelector("a");s&&s.replaceWith(s.firstChild)}componentDidLoad(){"wishlist"===salla.config.get("page.slug")&&document.getElementById("page-main-title")?.remove()}get host(){return e(this)}};c.style=":host{display:block}";const u=class{constructor(t){s(this,t),this.shape="btn",this.color="primary",this.fill="solid",this.size="medium",this.width="normal",this.loading=!1,this.disabled=!1,this.loaderPosition="after",this.type="button"}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host.querySelector("button").removeAttribute("loading"),"center"==this.loaderPosition&&this.text.classList.remove("s-button-hide"),this.host}async setText(s){return this.text.innerHTML=s,this.host}async disable(){return this.host.setAttribute("disabled",""),this.host}async enable(){return this.host.removeAttribute("disabled"),this.host}getBtnAttributes(){const s={};for(let t=0;t<this.host.attributes.length;t++)["color","fill","size","width","id"].includes(this.host.attributes[t].name)||(s[this.host.attributes[t].name]=this.host.attributes[t].value);s.type=s.type||this.type;const t=s.class||"";return s.class=t+" s-button-element s-button-"+this.shape+" s-button-"+("none"==this.fill?"fill-none":this.fill)+("medium"!=this.size?" s-button-"+this.size:"")+("normal"!=this.width?" s-button-"+this.width:"")+("link"==this.shape?" s-button-"+this.color+"-link":"")+("link"!=this.shape&&"outline"!=this.fill?" s-button-"+this.color:"")+("outline"==this.fill?" s-button-"+this.color+"-outline":"")+(this.disabled?" s-button-disabled ":"")+("icon"==this.shape?" s-button-loader-center":" s-button-loader-"+this.loaderPosition),s["aria-label"]||s["aria-labelledby"]||(this.host.textContent||"").trim()||(t.includes("btn--wishlist")||t.includes("wishlist")?s["aria-label"]=salla.lang.getWithDefault("pages.products.add_to_wishlist","Add or remove to wishlist"):"icon"===this.shape&&console.warn("Icon button is missing aria-label attribute")),s}button(){return t("button",{...this.getBtnAttributes(),disabled:this.disabled},t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:"s-button-loader"}):"")}render(){return this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":t(i,{class:"s-button-wrap"},this.href?t("a",{href:this.href},this.button()):this.button())}get host(){return e(this)}};u.style="";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert-engine</title>\n<path d="M16 18.673c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM2.667 16c0-3.092 1.083-6.105 3.047-8.484 0.469-0.568 0.389-1.408-0.179-1.877-0.568-0.468-1.408-0.388-1.877 0.179-2.359 2.857-3.657 6.473-3.657 10.183s1.299 7.325 3.657 10.183c0.264 0.319 0.645 0.484 1.029 0.484 0.299 0 0.6-0.1 0.848-0.305 0.568-0.469 0.648-1.309 0.179-1.877-1.964-2.379-3.047-5.392-3.047-8.484zM16 10.667c-0.736 0-1.333 0.597-1.333 1.333v4c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-0.736-0.597-1.333-1.333-1.333zM16 5.333c-5.881 0-10.667 4.785-10.667 10.667s4.785 10.667 10.667 10.667 10.667-4.785 10.667-10.667-4.785-10.667-10.667-10.667zM16 24c-4.412 0-8-3.588-8-8s3.588-8 8-8 8 3.588 8 8-3.588 8-8 8zM28.343 5.817c-0.469-0.567-1.307-0.647-1.877-0.179-0.568 0.469-0.648 1.309-0.179 1.877 1.964 2.379 3.047 5.392 3.047 8.484s-1.083 6.105-3.047 8.484c-0.469 0.568-0.389 1.408 0.179 1.877 0.249 0.205 0.549 0.305 0.848 0.305 0.384 0 0.765-0.165 1.028-0.484 2.36-2.857 3.659-6.473 3.659-10.183s-1.299-7.325-3.657-10.183z"></path>\n</svg>\n';const b=class{constructor(t){s(this,t),this.drawerVisibilityChanged=a(this,"drawerVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="right",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("drawer::open",(s=>s==this.host.id&&this.open())),salla.event.on("drawer::close",(s=>s==this.host.id&&this.close())),this.drawerTitle=this.host.getAttribute("drawer-title")}handleVisible(s){if(!s)return this.drawerVisibilityChanged.emit(!1),void this.toggleDrawer(!1);this.drawerVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleDrawer(!0)))}handleKeyUp(s){"Escape"===s.key&&this.closeDrawer()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.drawerTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleDrawer(s){const t=this.host.querySelector(".s-drawer-body");d.toggleElementClassIf(t,"s-drawer-entering","s-drawer-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-drawer-entering","s-drawer-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"drawer-is-open","drawer-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeDrawer(s){this.isClosable&&(salla.event.dispatch("drawer::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-drawer-icon":!0,"s-drawer-bg-error":"error"==this.iconStyle,"s-drawer-bg-success":"success"==this.iconStyle,"s-drawer-bg-normal":!this.iconStyle,"s-drawer-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-drawer",this.isLoading?t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body flex justify-center s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("div",{class:{"s-drawer-header":!0,"s-drawer-is-center":this.centered}},this.isClosable?t("button",{class:"s-drawer-close",onClick:()=>this.closeDrawer("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.drawerTitle||this.subTitle?t("div",{class:"s-drawer-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-drawer-header-content"},this.drawerTitle?t("div",{class:{"s-drawer-title":!0,"s-drawer-title-below":this.subTitleFirst},innerHTML:this.drawerTitle}):"",this.subTitle?t("p",{class:{"s-drawer-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};b.style="";const p=class{constructor(t){s(this,t),this.size=32,this.width=2,this.color=void 0,this.bgColor="#e5e7eb"}render(){return t(i,{key:"a3ab1e66f7b26628e7bfb1f5560127d042203cf3",class:"s-loading-container"},t("svg",{key:"e33089cee347160eaea4ded8ab8a5543a91f5ea1","aria-hidden":"true",style:{width:`${this.size}px`,height:`${this.size}px`,fill:this.color,color:this.bgColor},class:"s-loading",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"8163f98231203552ea3f514ac3b8cd16a8d9426c",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),t("path",{key:"959ea259b039d16be8b9dc39a2fb2e409bfffe0e",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})))}};p.style=".s-loading{animation:spin 1s linear infinite;fill:var(--color-primary)}.s-loading-container{display:flex;justify-content:center;align-items:center}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const g=class{constructor(t){s(this,t),this.modalVisibilityChanged=a(this,"modalVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="middle",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("modal::open",(s=>s==this.host.id&&this.open())),salla.event.on("modal::close",(s=>s==this.host.id&&this.close())),this.modalTitle=this.host.getAttribute("modal-title")}handleVisible(s){if(!s)return this.modalVisibilityChanged.emit(!1),void this.toggleModal(!1);this.modalVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleModal(!0)))}handleKeyUp(s){"KeyUp"===s.key&&this.closeModal()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.modalTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleModal(s){const t=this.host.querySelector(".s-modal-body");d.toggleElementClassIf(t,"s-modal-entering","s-modal-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeModal(s){this.isClosable&&(salla.event.dispatch("modal::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-modal-icon":!0,"s-modal-bg-error":"error"==this.iconStyle,"s-modal-bg-success":"success"==this.iconStyle,"s-modal-bg-normal":!this.iconStyle,"s-modal-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-modal",this.isLoading?t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},""),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},""),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("div",{class:{"s-modal-header":!0,"s-modal-is-center":this.centered}},this.isClosable?t("button",{class:"s-modal-close",onClick:()=>this.closeModal("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.modalTitle||this.subTitle?t("div",{class:"s-modal-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-modal-header-content"},this.modalTitle?t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.modalTitle}):"",this.subTitle?t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};g.style="@media screen and (max-width: 470px){.modal-is-open{position:fixed;width:100%}}";export{h as salla_accordion,c as salla_breadcrumb,u as salla_button,b as salla_drawer,p as salla_loading,g as salla_modal}
|
|
4
|
+
import{r as s,h as t,H as i,a as e,c as a}from"./p-DBMDFsFH.js";import{A as r,a as l}from"./p-Vqpj4CWE.js";import{S as o}from"./p-8Tsmrwno.js";import{C as n}from"./p-BV4kqbdL.js";import{H as d}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";const h=class{constructor(t){s(this,t),this.collapsible=!0,this.bordered=!1,this.size="md",this.collapsed=!0,this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");this.collapsible&&s&&(s.setAttribute("collapsible","true"),s.setAttribute("collapsed",this.collapsed.toString()))}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");this.collapsible&&(this.host.setAttribute("data-collapsed",this.collapsed.toString()),s?.setAttribute("data-collapsed",this.collapsed.toString()))}render(){return t(i,{key:"1ea35adcb3558cad1c5e675ed7330e3859c31d20",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"596f47501e2080874cd28a304bc55b88409699cf"}))}get host(){return e(this)}};h.style="";const c=class{constructor(t){s(this,t),this.sessionStorageKey="breadcrumb_snapshot",this.itemSlot=this.host.querySelector('[slot="item"]')?.outerHTML||'<li class="s-breadcrumb-item"><a href={url}>{title}</a></li>',this.iconSlot=this.host.querySelector('[slot="icon"]')?.outerHTML}componentWillLoad(){return new Promise((s=>salla.onReady((()=>salla.lang.onLoaded(s))))).then((()=>{if(salla.url.is_page("index"))throw new Error("salla-breadcrumb:: breadcrumb not supported on home page")})).then((()=>{const s=salla.config.get("page");if("wishlist"===s?.slug)return void(this.breadcrumbs=[]);if(!salla.config.get("theme.settings.is_breadcrumbs_enabled",!0))throw new Error("salla-breadcrumb:: merchant disabled the feature");if(!s||!s.slug)return salla.logger.error('salla-breadcrumbs:: page object not existed on salla.config.get("page")!'),void(this.breadcrumbs=[]);let t=this.getSessionBreadcrumbs(),i=t[t.length-1];return"product.single"===s.slug&&t&&t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url?(t.push({title:s.title,url:s.url}),this.breadcrumbs=this.setBreadcrumbsFromArray(t),this.storeBreadcrumbSnapshot()):t&&t.length>0?this.isNewPage(s,t)?(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()):this.breadcrumbs=this.setBreadcrumbsFromArray(t):(this.breadcrumbs=this.generateBreadcrumbs(s),this.storeBreadcrumbSnapshot()),this.breadcrumbs?.length&&(this.breadcrumbs[this.breadcrumbs.length-1].is_last=!0),this.breadcrumbs})).catch((s=>{salla.logger.error("salla-breadcrumb:: unexpected error!",s),this.breadcrumbs=[]}))}getSessionBreadcrumbs(){return"search-bar"===new URLSearchParams(window.location.search).get("from")?[]:JSON.parse(sessionStorage.getItem(this.sessionStorageKey)||"[]")}isNewPage(s,t){const i=t[t.length-1];return i?.url!==s.url}setBreadcrumbsFromArray(s){return s.map(((t,i)=>({...t,is_last:i===s.length-1})))}sanitizeBreadcrumbTitle(s,t=1){if(!s.includes("|"))return s.trim();const i=s.split("|").map((s=>s.trim())).filter(Boolean);return i[t]||i[0]||s.replace(/\|/g,"").trim()}generateBreadcrumbs(s){let t=[];if("product.single"===s.slug){const t=this.getSessionBreadcrumbs(),i=t[t.length-1];if(t.length>0&&i?.url&&s.parent?.url&&i.url===s.parent.url)return this.setBreadcrumbsFromArray([...t,{title:s.title,url:s.url}])}let i=s;for(;i;)i.title&&t.unshift({title:i.title,url:i.url}),i=i.parent;return s.slug.includes("customer")&&"customer.profile"!==s.slug&&t.unshift({title:salla.lang.get("common.titles.profile"),url:salla.url.get("profile")}),s.slug.includes("blog")&&t.unshift({title:salla.lang.get("blocks.footer.blog"),url:salla.url.get("blog")}),"brands.single"===s.slug&&t.unshift({title:salla.lang.get("common.titles.brands"),url:salla.url.get("brands")}),s.title||"loyalty"!==s.slug||t.unshift({title:salla.lang.get("common.titles.loyalty_program"),url:salla.url.get("loyalty")}),t.unshift({title:salla.lang.get("common.titles.home"),url:salla.url.get("")}),t}storeBreadcrumbSnapshot(){try{const s=salla.config.get("page");if("product.single"===s?.slug||"wishlist"===s?.slug)return;const t=[...this.breadcrumbs],i=t.length-1;i>=0&&(t[i].url=window.location.href);const e=JSON.stringify(t);sessionStorage.setItem(this.sessionStorageKey,e)}catch(s){salla.logger.error("salla-breadcrumb:: Failed to store breadcrumb snapshot in sessionStorage.",s)}}render(){if(this.breadcrumbs.length<=1)return salla.log("salla-breadcrumb:: There is no breadcrumbs!"),null;if("wishlist"===salla.config.get("page.slug"))return null;const s="product.single"===salla.config.get("page.slug");return[t("ol",{class:{"s-breadcrumb-wrapper":!0,"s-breadcrumb-dark":salla.url.is_page("loyalty"),"s-breadcrumb-primary-reverse":salla.config.get("page.slug").includes("customer")}},this.breadcrumbs.map((i=>{const e=s&&i.is_last?i.title:this.sanitizeBreadcrumbTitle(i.title),a=this.itemSlot.replace(/\{url\}/g,i.url).replace(/\{title\}/g,e);return[t("div",{class:"s-breadcrumb-slot",innerHTML:a}),this.getArrowDomForItem(i)]}))),t("script",{type:"application/ld+json",innerHTML:this.getJsonLd(s)})]}getJsonLd(s){const t=this.breadcrumbs.map(((t,i)=>{const e={"@type":"ListItem",position:i+1,name:s&&t.is_last?t.title:this.sanitizeBreadcrumbTitle(t.title)};return!t.is_last&&t.url&&(e.item=this.toAbsoluteUrl(t.url)),e}));return JSON.stringify({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:t}).replace(/</g,"\\u003c")}toAbsoluteUrl(s){try{return new URL(s,window.location.origin).href}catch{return s}}getArrowDomForItem(s){if(s.is_last)return"";let i=this.iconSlot||(salla.config.get("theme.is_rtl",!0)?r:l);return t("li",{class:"s-breadcrumb-arrow"},t("div",{class:{"s-breadcrumb-icon-slot":!0,"s-breadcrumb-default-icon":!this.iconSlot},innerHTML:i}))}componentDidRender(){this.host.querySelectorAll(".s-breadcrumb-slot").forEach((s=>s.replaceWith(s.firstChild))),this.host.querySelectorAll(".s-breadcrumb-icon-slot.s-breadcrumb-default-icon").forEach((s=>s.replaceWith(s.querySelector("svg")))),this.host.querySelector('[slot="item"]')?.remove(),this.host.querySelector('[slot="icon"]')?.remove();let s=this.host.querySelectorAll(".s-breadcrumb-item")[this.breadcrumbs.length-1]?.querySelector("a");s&&s.replaceWith(s.firstChild)}componentDidLoad(){"wishlist"===salla.config.get("page.slug")&&document.getElementById("page-main-title")?.remove()}get host(){return e(this)}};c.style=":host{display:block}";const u=class{constructor(t){s(this,t),this.shape="btn",this.color="primary",this.fill="solid",this.size="medium",this.width="normal",this.loading=!1,this.disabled=!1,this.loaderPosition="after",this.type="button"}async load(){return"center"==this.loaderPosition&&this.text.classList.add("s-button-hide"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host.querySelector("button").removeAttribute("loading"),"center"==this.loaderPosition&&this.text.classList.remove("s-button-hide"),this.host}async setText(s){return this.text.innerHTML=s,this.host}async disable(){return this.host.setAttribute("disabled",""),this.host}async enable(){return this.host.removeAttribute("disabled"),this.host}getBtnAttributes(){const s={};for(let t=0;t<this.host.attributes.length;t++)["color","fill","size","width","id"].includes(this.host.attributes[t].name)||(s[this.host.attributes[t].name]=this.host.attributes[t].value);s.type=s.type||this.type;const t=s.class||"";return s.class=t+" s-button-element s-button-"+this.shape+" s-button-"+("none"==this.fill?"fill-none":this.fill)+("medium"!=this.size?" s-button-"+this.size:"")+("normal"!=this.width?" s-button-"+this.width:"")+("link"==this.shape?" s-button-"+this.color+"-link":"")+("link"!=this.shape&&"outline"!=this.fill?" s-button-"+this.color:"")+("outline"==this.fill?" s-button-"+this.color+"-outline":"")+(this.disabled?" s-button-disabled ":"")+("icon"==this.shape?" s-button-loader-center":" s-button-loader-"+this.loaderPosition),s["aria-label"]||s["aria-labelledby"]||(this.host.textContent||"").trim()||(t.includes("btn--wishlist")||t.includes("wishlist")?s["aria-label"]=salla.lang.getWithDefault("pages.products.add_to_wishlist","Add or remove to wishlist"):"icon"===this.shape&&console.warn("Icon button is missing aria-label attribute")),s}button(){return t("button",{...this.getBtnAttributes(),disabled:this.disabled},t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:"s-button-loader"}):"")}render(){return this.host.closest(".swiper-slide")?.classList.contains("swiper-slide-duplicate")?"":t(i,{class:"s-button-wrap"},this.href?t("a",{href:this.href},this.button()):this.button())}get host(){return e(this)}};u.style="";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert-engine</title>\n<path d="M16 18.673c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM2.667 16c0-3.092 1.083-6.105 3.047-8.484 0.469-0.568 0.389-1.408-0.179-1.877-0.568-0.468-1.408-0.388-1.877 0.179-2.359 2.857-3.657 6.473-3.657 10.183s1.299 7.325 3.657 10.183c0.264 0.319 0.645 0.484 1.029 0.484 0.299 0 0.6-0.1 0.848-0.305 0.568-0.469 0.648-1.309 0.179-1.877-1.964-2.379-3.047-5.392-3.047-8.484zM16 10.667c-0.736 0-1.333 0.597-1.333 1.333v4c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-0.736-0.597-1.333-1.333-1.333zM16 5.333c-5.881 0-10.667 4.785-10.667 10.667s4.785 10.667 10.667 10.667 10.667-4.785 10.667-10.667-4.785-10.667-10.667-10.667zM16 24c-4.412 0-8-3.588-8-8s3.588-8 8-8 8 3.588 8 8-3.588 8-8 8zM28.343 5.817c-0.469-0.567-1.307-0.647-1.877-0.179-0.568 0.469-0.648 1.309-0.179 1.877 1.964 2.379 3.047 5.392 3.047 8.484s-1.083 6.105-3.047 8.484c-0.469 0.568-0.389 1.408 0.179 1.877 0.249 0.205 0.549 0.305 0.848 0.305 0.384 0 0.765-0.165 1.028-0.484 2.36-2.857 3.659-6.473 3.659-10.183s-1.299-7.325-3.657-10.183z"></path>\n</svg>\n';const b=class{constructor(t){s(this,t),this.drawerVisibilityChanged=a(this,"drawerVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="right",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("drawer::open",(s=>s==this.host.id&&this.open())),salla.event.on("drawer::close",(s=>s==this.host.id&&this.close())),this.drawerTitle=this.host.getAttribute("drawer-title")}handleVisible(s){if(!s)return this.drawerVisibilityChanged.emit(!1),void this.toggleDrawer(!1);this.drawerVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleDrawer(!0)))}handleKeyUp(s){"Escape"===s.key&&this.closeDrawer()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.drawerTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleDrawer(s){const t=this.host.querySelector(".s-drawer-body");d.toggleElementClassIf(t,"s-drawer-entering","s-drawer-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-drawer-entering","s-drawer-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"drawer-is-open","drawer-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeDrawer(s){this.isClosable&&(salla.event.dispatch("drawer::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-drawer-icon":!0,"s-drawer-bg-error":"error"==this.iconStyle,"s-drawer-bg-success":"success"==this.iconStyle,"s-drawer-bg-normal":!this.iconStyle,"s-drawer-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-drawer",this.isLoading?t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body flex justify-center s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-drawer s-drawer s-drawer-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-drawer-overlay s-drawer-overlay-leaving",ref:s=>this.overlay=s,onClick:()=>this.closeDrawer("backdropClick")}),t("div",{class:"s-drawer-wrapper s-drawer-wrapper-"+this.position},t("div",{class:"s-drawer-body s-drawer-leaving s-drawer-"+this.position+" s-drawer-"+this.getWidth()+(this.noPadding?" s-drawer-nopadding":" s-drawer-padding")},t("div",{class:{"s-drawer-header":!0,"s-drawer-is-center":this.centered}},this.isClosable?t("button",{class:"s-drawer-close",onClick:()=>this.closeDrawer("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.drawerTitle||this.subTitle?t("div",{class:"s-drawer-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-drawer-header-content"},this.drawerTitle?t("div",{class:{"s-drawer-title":!0,"s-drawer-title-below":this.subTitleFirst},innerHTML:this.drawerTitle}):"",this.subTitle?t("p",{class:{"s-drawer-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};b.style="";const p=class{constructor(t){s(this,t),this.size=32,this.width=2,this.color=void 0,this.bgColor="#e5e7eb"}render(){return t(i,{key:"a3ab1e66f7b26628e7bfb1f5560127d042203cf3",class:"s-loading-container"},t("svg",{key:"e33089cee347160eaea4ded8ab8a5543a91f5ea1","aria-hidden":"true",style:{width:`${this.size}px`,height:`${this.size}px`,fill:this.color,color:this.bgColor},class:"s-loading",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"8163f98231203552ea3f514ac3b8cd16a8d9426c",d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),t("path",{key:"959ea259b039d16be8b9dc39a2fb2e409bfffe0e",d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})))}};p.style=".s-loading{animation:spin 1s linear infinite;fill:var(--color-primary)}.s-loading-container{display:flex;justify-content:center;align-items:center}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const g=class{constructor(t){s(this,t),this.modalVisibilityChanged=a(this,"modalVisibilityChanged"),this.isClosable=!0,this.width="md",this.position="middle",this.visible=!1,this.hasSkeleton=!1,this.isLoading=!1,this.subTitleFirst=!1,this.noPadding=!1,this.subTitle="",this.centered=!1,this.iconStyle=void 0,salla.event.on("modal::open",(s=>s==this.host.id&&this.open())),salla.event.on("modal::close",(s=>s==this.host.id&&this.close())),this.modalTitle=this.host.getAttribute("modal-title")}handleVisible(s){if(!s)return this.modalVisibilityChanged.emit(!1),void this.toggleModal(!1);this.modalVisibilityChanged.emit(!0),this.host.classList.remove("s-hidden"),setTimeout((()=>this.toggleModal(!0)))}handleKeyUp(s){"KeyUp"===s.key&&this.closeModal()}async open(){return this.host.setAttribute("visible",""),this.handleAutoFocus(),this.host}async close(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.modalTitle=s,this.host}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}handleAutoFocus(){const s=this.host.querySelector("input, textarea, select");s&&setTimeout((()=>{s.focus()}),100)}toggleModal(s){const t=this.host.querySelector(".s-modal-body");d.toggleElementClassIf(t,"s-modal-entering","s-modal-leaving",(()=>s)).toggleElementClassIf(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>s)).toggleElementClassIf(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("s-hidden")),350)}closeModal(s){this.isClosable&&(salla.event.dispatch("modal::close",{reason:s}),this.host.removeAttribute("visible"))}iconBlockClasses(){return{"s-modal-icon":!0,"s-modal-bg-error":"error"==this.iconStyle,"s-modal-bg-success":"success"==this.iconStyle,"s-modal-bg-normal":!this.iconStyle,"s-modal-bg-primary":"primary"==this.iconStyle}}getWidth(){return this.isLoading?this.hasSkeleton?"md":"xs":this.width}render(){return this.host.id=this.host.id||"salla-modal",this.isLoading?t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog",onKeyUp:s=>this.handleKeyUp(s)},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},""),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("slot",{name:"loading"},t("salla-loading",null)),t("div",{class:"s-hidden"},t("slot",null))))):t(i,{class:"salla-modal s-modal s-modal-container s-hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal("backdropClick")}),t("div",{class:"s-modal-wrapper"},t("span",{class:"s-modal-spacer s-modal-align-"+this.position},""),t("div",{class:"s-modal-body s-modal-align-"+this.position+" s-modal-"+this.getWidth()+(this.noPadding?" s-modal-nopadding":" s-modal-padding")},t("div",{class:{"s-modal-header":!0,"s-modal-is-center":this.centered}},this.isClosable?t("button",{class:"s-modal-close",onClick:()=>this.closeModal("closeButtonClick"),type:"button"},t("span",{innerHTML:o})):"",this.modalTitle||this.subTitle?t("div",{class:"s-modal-header-inner"},t("slot",{name:"icon"},this.iconStyle?t("div",{class:this.iconBlockClasses(),innerHTML:"error"==this.iconStyle?m:n}):""),t("div",{class:"s-modal-header-content"},this.modalTitle?t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.modalTitle}):"",this.subTitle?t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle}):"")):""),t("slot",null),t("slot",{name:"footer"}))))}componentDidLoad(){document.body.append(this.host)}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};g.style="@media screen and (max-width: 470px){.modal-is-open{position:fixed;width:100%}}";export{h as salla_accordion,c as salla_breadcrumb,u as salla_button,b as salla_drawer,p as salla_loading,g as salla_modal}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as t,a as s}from"./p-
|
|
4
|
+
import{r as a,h as t,a as s}from"./p-DBMDFsFH.js";import{S as l}from"./p-CXRKXFgT.js";import{T as e}from"./p-CcfoPQKG.js";const r=class{constructor(t){a(this,t)}get productId(){return this.host.dataset.productId||salla.config.get("page.id")}componentWillLoad(){return salla.onReady().then((()=>salla.lang.onLoaded())).then((()=>this.prize())).catch((a=>salla.logger.error(a)))}handleClick(){salla.config.isGuest()?salla.event.dispatch("login::open"):this.exchangeModal.open()}render(){return"success"===this.prize.status&&this.productId?t("div",{class:"s-loyalty-program-banner-container"},t("div",null,t("p",{class:"s-loyalty-program-banner-container-banner-title"},salla.lang.get("pages.loyalty_program.want_to_redeem_free_product")),t("p",{class:"s-loyalty-program-banner-container-banner-subtitle"},salla.lang.get("pages.loyalty_program.exchange_points_for_free_product",{points:this.prize.data.cost_points}))),t("button",{onClick:()=>this.handleClick()},t("span",{innerHTML:l}),t("span",null,salla.lang.get("pages.loyalty_program.exchange_points"))),t("salla-modal",{ref:a=>this.exchangeModal=a,width:"sm"},this.prize.data?t("salla-reward-exchange",{productId:Number(this.productId),prize:this.prize.data}):"")):null}get host(){return s(this)}};(function(a,t,s,l){var e,r=arguments.length,o=r<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,s):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,t,s,l);else for(var n=a.length-1;n>=0;n--)(e=a[n])&&(o=(r<3?e(o):r>3?e(t,s,o):e(t,s))||o);r>3&&o&&Object.defineProperty(t,s,o)})([e((async function(){if(!(salla.config.get("store.features")||[]).includes("loyalty-system"))return Promise.reject("Loyalty system is not enabled for merchant");const{loyalty_prize:a}=await salla.product.api.getDetails(this.productId);return a||Promise.reject("no loyalty prize for this product")}))],r.prototype,"prize",void 0),r.style="";export{r as salla_loyalty_banner}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as a,H as t,a as o}from"./p-
|
|
4
|
+
import{r as s,h as a,H as t,a as o}from"./p-DBMDFsFH.js";const c=class{constructor(a){s(this,a),this.availableCoupons=[],this.cartTotal=0,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=s=>{this.cartTotal=s.sub_total??s.total??0;const a=s.coupon||"";a!==this.currentCoupon&&(this.currentCoupon=a,this.couponInputValue=a),this.couponError=""},this.couponAddedHandler=()=>{},this.couponAdditionFailedHandler=s=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(s?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{},this.onKeyUp=s=>{"Enter"===s.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=s=>{this.couponInputValue=s.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadCouponsData(),this.loadCartTotal(),this.setupCartEventListeners()}componentDidLoad(){this.setupCouponInputEvents()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){this.couponInputRef?.removeEventListener("keyup",this.onKeyUp),this.couponInputRef?.removeEventListener("input",this.onInput),salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(s){const a=this.availableCoupons.find((a=>a.code===s));if(a){if(!this.isEligible(a))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(s),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:a,bubbles:!0}))}catch(s){throw s}}return a}async loadCouponsData(){try{const s=await salla.api.request("coupons"),a=s?.data,t=Array.isArray(a)?a:Array.isArray(a?.data)?a.data:[];this.availableCoupons=t}catch(s){console.warn("Failed to load coupons:",s),this.availableCoupons=[]}}loadCartTotal(){const s=salla.storage.get("cart");this.cartTotal=s?.summary?.sub_total??s?.sub_total??0,this.currentCoupon=s?.coupon||"",this.couponInputValue=s?.coupon||""}setupCouponInputEvents(){this.couponInputRef&&this.couponButtonRef&&(this.couponInputRef.addEventListener("keyup",this.onKeyUp),this.couponInputRef.addEventListener("input",this.onInput))}async handleCouponButtonClick(){if(this.isApplying)return;const s=!!this.currentCoupon;if(s||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{s?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim())}catch(s){this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}showCouponError(s){this.couponError=s}handleCouponClick(s){this.applyCoupon(s.code,!1).catch((()=>{}))}async applyCoupon(s,a=!0){if(this.isApplying){if(a)throw new Error("Coupon application already in progress")}else{this.couponInputValue=s,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(s.trim())}catch(s){if(this.showCouponError(s.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),a)throw s}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(s){if("percentage"===s.type)return`${salla.helpers.number("object"==typeof s.amount?s.amount.amount:s.amount)}%`;{const t="object"==typeof s.amount?s.amount:{amount:s.amount,currency:s.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return a("span",{innerHTML:salla.money(t.amount,t.currency)})}}isEligible(s){return!(s.minimum_amount&&this.cartTotal<parseFloat(s.minimum_amount.amount))}renderCouponCard(s){const t=this.isEligible(s);return a("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},a("div",{class:"s-cart-coupons-card "+(!t||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>t&&!this.isApplying&&this.handleCouponClick(s)},a("div",{class:"s-cart-coupons-top-section"},a("div",{class:"s-cart-coupons-discount-values"},a("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(s)),s.free_shipping?a("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):s.maximum_amount&&a("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",a("span",{innerHTML:salla.money(s.maximum_amount.amount,s.maximum_amount.currency)}))),a("div",{class:"s-cart-coupons-code"},s.code)),a("div",{class:"s-cart-coupons-divider"}),a("div",{class:"s-cart-coupons-bottom-section"},a("div",{class:"s-cart-coupons-terms"},null!=s.remaining_days&&a("div",{class:"s-cart-coupons-expiry "+(s.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===s.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${s.remaining_days} ${salla.lang.get("pages.cart.day")}`),s.minimum_amount&&parseFloat(s.minimum_amount.amount)>0&&a("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",a("span",{innerHTML:salla.money(s.minimum_amount.amount,s.minimum_amount.currency)}))),a("div",{class:"s-cart-coupons-action"},t?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return a(t,{key:"09c964ef1b706cd623f5b99b9606ecf93486e8b5"},a("div",{key:"a3b3313ecbc23821cca29115f1189ca2dfbcbb48",class:"s-cart-coupons-wrapper"},a("div",{key:"27bc855b95d252a4feffc256fdef70b7d83aa4b3",class:"s-cart-coupons-input-section"},a("label",{key:"d17fff32352bc8e0535986519d5e22dda7879754",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),a("div",{key:"4e9acdb76110fffbd6984fa522fa91440d8c3bc6",class:"s-cart-coupons-coupon-input-container"},a("input",{key:"2f0e3ee9a44db390caeeb4e85f40aab825c91182",type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,ref:s=>this.couponInputRef=s,"aria-label":salla.lang.get("pages.cart.apply_coupon")}),a("salla-button",{key:"a7356872f2eaae51bf77207c0fcfd10ea3c25313",ref:s=>this.couponButtonRef=s,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick()},this.currentCoupon?a("i",{class:"sicon-cancel"}):a("span",null,salla.lang.get("pages.cart.save_coupon")))),this.couponError&&a("span",{key:"4d0b025d425e2fbba8f313b92c1e257042c549b0",class:"s-cart-coupons-coupon-error"},this.couponError)),this.availableCoupons&&this.availableCoupons.length>0&&a("salla-slider",{key:"ac6a96179ec2990f8fedfd3cbb63404e7fe60edf",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},a("div",{key:"7c4f2641aa87a91d55d88d5fc0a375a5d3114a99",slot:"items"},this.availableCoupons.map((s=>this.renderCouponCard(s)))))))}get host(){return o(this)}};c.style="";export{c as salla_cart_coupons}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as s,a as e}from"./p-DJPd6DKq.js";import{a as t}from"./p-CgtvEd63.js";import{f as i,t as o}from"./p-CO-PeZ27.js";import{e as l}from"./p-DzAIgzdz.js";import{S as r}from"./p-8Tsmrwno.js";var c,n='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>link</title>\n<path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>\n</svg>\n',d='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>whatsapp</title>\n<path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>\n</svg>\n';!function(a){a.FACEBOOK="facebook",a.TWITTER="twitter",a.WHATSAPP="whatsapp",a.EMAIL="email",a.COPY_LINK="copy_link"}(c||(c={}));const h=class{constructor(s){a(this,s),this.ignoreOutsideClick=!1,this.translationDefaults={"common.social.share":{ar:"مشاركة",en:"Share"},"common.social.email":{ar:"إيميل",en:"Email"},"common.social.whatsapp":{ar:"واتساب",en:"WhatsApp"},"common.social.twitter":{ar:"أكس",en:"X"},"common.social.facebook":{ar:"فيسبوك",en:"Facebook"},"common.social.copy":{ar:"نسخ",en:"Copy"},"common.social.copied":{ar:"تم النسخ",en:"Copied"}},this.onDocumentClick=a=>{this.ignoreOutsideClick||!this.opened||this.host.contains(a.target)||this.close()},this.opened=!1,this.copied=!1,this.allPlatforms=[c.WHATSAPP,c.FACEBOOK,c.TWITTER,c.EMAIL,c.COPY_LINK],this.platformIcons=[{icon:d,name:c.WHATSAPP},{icon:i,name:c.FACEBOOK},{icon:o,name:c.TWITTER},{icon:l,name:c.EMAIL},{icon:n,name:c.COPY_LINK}],this.convertedPlatforms=[],this.url="",this.urlName="",this.platforms="facebook,twitter,whatsapp,email,copy_link",this.mode="default",this.modalTitle=""}componentWillLoad(){if(this.registerTranslationDefaults(),this.host.hasAttribute("aria-label")&&this.host.removeAttribute("aria-label"),document.getElementById("a2a-script"))return;const a=document.createElement("script");a.src="https://static.addtoany.com/menu/page.js",a.setAttribute("id","a2a-script"),a.async=!0,a.onload=function(){window.a2a_config.locale=salla.config.get("user.language_code",salla.lang.getLocale()),window.a2a_config.callbacks=window.a2a_config.callbacks||[],window.a2a_config.callbacks.push({share:a=>{const s={share_via:a.service.toLowerCase(),url:a.url,title:a.title};salla.event.emit("share-element",s)}})},document.body.appendChild(a)}componentDidLoad(){document.addEventListener("click",this.onDocumentClick)}disconnectedCallback(){document.removeEventListener("click",this.onDocumentClick),this.copiedResetTimeout&&window.clearTimeout(this.copiedResetTimeout),this.setBodyScrollLocked(!1)}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const a=Object.entries(this.translationDefaults).reduce(((a,[s,e])=>(salla.lang.get(s)===s&&(a[s]=e),a)),{});Object.keys(a).length&&salla.lang.addBulk(a)}resolveShareKit(){return this.host.querySelector(".a2a_kit")}deferOutsideClickGuard(){this.ignoreOutsideClick=!0,requestAnimationFrame((()=>{this.ignoreOutsideClick=!1}))}async open(){if(this.opened)return;if(this.opened=!0,this.deferOutsideClickGuard(),"modal"===this.mode&&this.setBodyScrollLocked(!0),await new Promise((a=>requestAnimationFrame((()=>a())))),!this.opened)return;if(await this.refresh(),"modal"===this.mode)return;const a=this.resolveShareKit();a?(this.openAnimation=(new t.timeline).add({targets:a,translateY:[-50,0],opacity:[0,1],duration:300,podding:"0",easing:"easeInOutSine"}),this.openAnimation.add({targets:a.children,translateZ:0,translateY:[-30,0],scaleY:[0,1],opacity:[0,1],duration:1400,delay:t.stagger(100)},"-=200")):this.opened=!1}async close(){this.opened&&(this.openAnimation?.pause(),this.openAnimation?.seek(0),this.opened=!1,"modal"===this.mode&&this.setBodyScrollLocked(!1))}setBodyScrollLocked(a){document.body.classList.toggle("s-social-share-modal-is-open",a)}toggle(){return this.opened?this.close():(this.deferOutsideClickGuard(),this.open())}onUrlChanged(a,s){a!==s&&this.refresh()}getShareUrl(){return this.url||window.location.href}getModalTitle(){return this.modalTitle||salla.lang.get("common.social.share")}syncShareAttributes(){const a=this.resolveShareKit();a&&(a.setAttribute("data-a2a-url",this.getShareUrl()),a.setAttribute("data-a2a-title",this.urlName||document.title))}async refresh(){this.syncShareAttributes(),"function"!=typeof window.a2a?.init_all?window.a2a?.init("page"):window.a2a.init_all()}async copyLink(){const a=this.getShareUrl();try{await navigator.clipboard.writeText(a)}catch{const s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy")}catch{}s.remove()}salla.event.emit("share-element",{share_via:"copy_link",url:a,title:this.urlName||document.title}),this.copied=!0,this.copiedResetTimeout&&window.clearTimeout(this.copiedResetTimeout),this.copiedResetTimeout=window.setTimeout((()=>this.copied=!1),2e3)}modalPlatformMeta(a){switch(a){case c.WHATSAPP:return{icon:d,color:"#25D366",label:salla.lang.get("common.social.whatsapp")};case c.FACEBOOK:return{icon:i,color:"#1877F2",label:salla.lang.get("common.social.facebook")};case c.TWITTER:return{icon:o,color:"#000000",label:salla.lang.get("common.social.twitter")};case c.EMAIL:return{icon:l,color:"#2BA6FF",label:salla.lang.get("common.social.email")};default:return{icon:n,color:"#6b7280",label:a}}}renderModalCard(a){const e=this.modalPlatformMeta(a);return s("a",{class:`s-social-share-modal-card a2a_button_${a}`,"aria-label":`Share Via ${a}`},s("span",{class:"s-social-share-modal-icon",style:{backgroundColor:e.color},innerHTML:e.icon}),s("span",{class:"s-social-share-modal-card-label"},e.label))}renderModal(){if(!this.opened)return null;const a=this.platforms.split(",").map((a=>a.trim())),e=[c.EMAIL,c.WHATSAPP,c.TWITTER,c.FACEBOOK].filter((s=>a.includes(s))),t=a.includes(c.COPY_LINK);return s("div",{class:"s-social-share-modal",onClick:a=>{a.target===a.currentTarget&&this.close()}},s("div",{class:"s-social-share-modal-dialog",role:"dialog","aria-modal":"true"},s("div",{class:"s-social-share-modal-handle","aria-hidden":"true"}),s("div",{class:"s-social-share-modal-header"},s("span",{class:"s-social-share-modal-title"},this.getModalTitle()),s("button",{type:"button",class:"s-social-share-modal-close","aria-label":salla.lang.get("common.elements.close"),onClick:()=>this.close()},s("span",{class:"s-social-share-modal-close-icon",innerHTML:r}))),s("div",{class:"s-social-share-modal-platforms a2a_kit","data-a2a-url":this.getShareUrl(),"data-a2a-title":this.urlName?this.urlName:document.title},e.map((a=>this.renderModalCard(a)))),t&&s("div",{class:"s-social-share-modal-copy-row"},s("span",{class:"s-social-share-modal-url",dir:"ltr"},this.getShareUrl()),s("salla-button",{type:"button",fill:"outline",onClick:()=>this.copyLink()},this.copied?salla.lang.get("common.social.copied"):salla.lang.get("common.social.copy")))))}renderPopupList(){return s("ul",{class:{"s-social-share-list":!0,a2a_kit:!0,share:!0,opened:this.opened},"data-a2a-url":this.getShareUrl(),"data-a2a-title":this.urlName?this.urlName:document.title},this.platforms.split(",").map((a=>s("li",null,s("a",{class:`a2a_button_${a}`,"aria-label":`Share Via ${a}`},this.platformIcons.map((e=>{if(e.name===a)return s("span",{class:"s-social-share-icon",innerHTML:e.icon})})))))))}render(){return s("div",{key:"e934ffb94fea491d445e62f26fcf98914ff0a399",class:"s-social-share-wrapper"},s("slot",{key:"8dbf4a0c3fb6fb17a0a7c32ace57b357708c0678",name:"widget"},s("salla-button",{key:"eb6459bc99d4587bbfc6c0399003a2860d6992b0","aria-label":"Share",onClick:()=>this.toggle(),class:"s-social-share-btn",shape:"icon",fill:"outline",color:"light"},s("span",{key:"3394f64755bd0bc07839b1a513f5459c8258f096",innerHTML:this.opened?r:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>share-alt</title>\n<path d="M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}))),"modal"===this.mode?this.renderModal():this.renderPopupList())}get host(){return e(this)}static get watchers(){return{url:["onUrlChanged"]}}};h.style=":global(body.s-social-share-modal-is-open){overflow:hidden}.s-social-share-modal{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;padding:1rem;background-color:rgba(17, 24, 39, 0.5)}.s-social-share-modal-dialog{position:relative;width:100%;max-width:32rem;padding:1.5rem;background-color:#fff;border-radius:1rem;box-shadow:0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)}.s-social-share-modal-handle{display:none}.s-social-share-modal-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}.s-social-share-modal-title{font-size:1.125rem;font-weight:700;color:#1f2937}.s-social-share-modal-close{display:inline-flex;align-items:center;justify-content:center;padding:0.25rem;line-height:0;background:transparent;border:0;cursor:pointer}.s-social-share-modal-close-icon svg{width:1.25rem;height:1.25rem;fill:#ef4444}.s-social-share-modal-platforms{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:0.75rem}.s-social-share-modal-card{display:flex;flex-direction:column;align-items:center;gap:0.5rem;padding:0.75rem;border:1px solid #e5e7eb;border-radius:0.75rem;text-decoration:none;cursor:pointer;transition:border-color 0.15s ease, box-shadow 0.15s ease}.s-social-share-modal-card:hover{border-color:#d1d5db;box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-social-share-modal-icon{display:flex;align-items:center;justify-content:center;width:3rem;height:3rem;border-radius:9999px}.s-social-share-modal-icon svg{width:1.25rem;height:1.25rem;fill:#fff}.s-social-share-modal-card-label{font-size:0.875rem;color:#4b5563}.s-social-share-modal-copy-row{display:flex;align-items:center;gap:0.75rem;margin-top:1rem;padding:0.5rem;background-color:#f3f4f6;border-radius:0.75rem}.s-social-share-modal-url{flex:1 1 auto;min-width:0;padding:0 0.5rem;font-size:0.875rem;color:#6b7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes s-social-share-sheet-in{from{transform:translateY(100%)}to{transform:translateY(0)}}@media (max-width: 640px){.s-social-share-modal{align-items:flex-end;justify-content:center;padding:0}.s-social-share-modal-dialog{max-width:none;padding:0.75rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));border-radius:1rem 1rem 0 0;box-shadow:0 -4px 24px rgba(0, 0, 0, 0.12);animation:s-social-share-sheet-in 0.28s ease-out}.s-social-share-modal-handle{display:block;width:2.5rem;height:0.25rem;margin:0 auto 0.75rem;background-color:#d1d5db;border-radius:9999px}.s-social-share-modal-header{margin-bottom:1rem}.s-social-share-modal-platforms{grid-template-columns:repeat(2, minmax(0, 1fr))}}";export{h as salla_social_share}
|
|
4
|
+
import{r as a,h as s,a as e}from"./p-DBMDFsFH.js";import{a as t}from"./p-CgtvEd63.js";import{f as i,t as o}from"./p-CO-PeZ27.js";import{e as l}from"./p-DzAIgzdz.js";import{S as r}from"./p-8Tsmrwno.js";var c,n='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>link</title>\n<path d="M19.247 23.019l-4.189 4.189c-2.831 2.831-7.435 2.831-10.265 0-1.371-1.372-2.125-3.193-2.125-5.132s0.755-3.761 2.125-5.133l4.189-4.191c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-4.189 4.191c-1.875 1.875-2.907 4.367-2.907 7.019s1.032 5.143 2.907 7.017 4.368 2.907 7.019 2.907 5.143-1.032 7.017-2.908l4.189-4.189c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.52-1.885 0.001zM22.276 9.724c-0.521-0.521-1.364-0.521-1.885 0l-10.667 10.667c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l10.667-10.667c0.521-0.521 0.521-1.364 0-1.885zM29.093 2.908c-1.875-1.876-4.368-2.908-7.019-2.908s-5.143 1.032-7.017 2.908l-4.189 4.188c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l4.189-4.189c2.831-2.831 7.435-2.831 10.265 0 1.371 1.372 2.125 3.193 2.125 5.132s-0.755 3.761-2.125 5.133l-4.189 4.191c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l4.189-4.191c1.875-1.875 2.907-4.367 2.907-7.019s-1.032-5.143-2.907-7.016z"></path>\n</svg>\n',d='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>whatsapp</title>\n<path d="M16 32c-0.008 0-0.018 0-0.028 0-3.1 0-5.993-0.887-8.439-2.421l0.066 0.039-7.2 2.3 2.336-6.964c-1.713-2.492-2.736-5.575-2.736-8.897 0-0.020 0-0.040 0-0.060v0.003c0.009-8.833 7.167-15.991 15.999-16h0.001c8.837 0 16 7.163 16 16s-7.163 16-16 16v0zM7.906 27.424l0.4 0.264c2.169 1.449 4.837 2.312 7.707 2.312 7.732 0 14-6.268 14-14s-6.268-14-14-14c-0.004 0-0.009 0-0.013 0h0.001c-7.729 0.008-13.992 6.271-14 13.999v0.001c-0 0.010-0 0.021-0 0.032 0 3.072 1 5.909 2.693 8.206l-0.027-0.038 0.304 0.416-1.4 4.2zM20.716 24.958c-1.684-0.131-3.237-0.574-4.641-1.271l0.073 0.033c-3.098-1.456-5.634-3.668-7.438-6.405l-0.042-0.067c-1.102-1.357-1.819-3.067-1.962-4.938l-0.002-0.030c-0.001-0.036-0.001-0.078-0.001-0.12 0-1.575 0.66-2.995 1.719-4l0.002-0.002c0.547-0.52 1.289-0.839 2.105-0.839 0.033 0 0.066 0.001 0.099 0.002l-0.005-0c0.2 0 0.378 0 0.542 0.018 0.016-0.001 0.035-0.001 0.054-0.001 0.815 0 1.502 0.549 1.711 1.298l0.003 0.012 0.324 0.782c0.376 0.906 0.858 2.068 0.942 2.244 0.144 0.251 0.23 0.552 0.23 0.873 0 0.286-0.068 0.557-0.188 0.797l0.005-0.010c-0.149 0.307-0.332 0.57-0.55 0.802l0.002-0.002c-0.148 0.168-0.248 0.274-0.346 0.378s-0.172 0.18-0.26 0.284c0.575 0.92 1.237 1.713 1.992 2.406l0.008 0.008c0.829 0.758 1.802 1.373 2.872 1.8l0.064 0.022c0.369-0.266 0.672-0.6 0.896-0.985l0.008-0.015 0.174-0.232c0.328-0.484 0.875-0.798 1.495-0.798 0.249 0 0.487 0.051 0.703 0.142l-0.012-0.004c0.492 0.168 2.922 1.372 2.946 1.384l0.228 0.11c0.415 0.149 0.758 0.417 0.996 0.763l0.004 0.007c0.107 0.349 0.169 0.75 0.169 1.166 0 0.591-0.125 1.153-0.349 1.661l0.010-0.026c-0.702 1.368-1.983 2.353-3.511 2.637l-0.031 0.005c-0.309 0.071-0.663 0.112-1.028 0.112-0.004 0-0.007 0-0.011 0h0.001zM10.632 9.318c-0.028-0.002-0.062-0.004-0.095-0.004-0.245 0-0.472 0.076-0.659 0.206l0.004-0.002c-0.726 0.651-1.18 1.591-1.18 2.638 0 0.044 0.001 0.087 0.002 0.13l-0-0.006c0.122 1.404 0.662 2.662 1.495 3.671l-0.009-0.011 0.12 0.168c1.627 2.491 3.865 4.46 6.504 5.723l0.096 0.041c3.136 1.288 3.916 1.124 4.426 1.014 0.87-0.159 1.601-0.656 2.067-1.347l0.007-0.011c0.12-0.316 0.204-0.682 0.237-1.063l0.001-0.015-0.040-0.018-0.256-0.124c-0.8-0.4-2.46-1.2-2.734-1.292l-0.058 0.184c-0.346 0.501-0.684 0.934-1.045 1.347l0.015-0.017c-0.344 0.349-0.821 0.565-1.349 0.565-0.28 0-0.546-0.061-0.785-0.17l0.012 0.005c-1.403-0.547-2.609-1.301-3.646-2.239l0.010 0.009c-0.975-0.891-1.81-1.912-2.486-3.039l-0.034-0.061c-0.152-0.244-0.242-0.54-0.242-0.857 0-0.463 0.191-0.88 0.499-1.178l0-0c0.13-0.162 0.264-0.302 0.4-0.444l0.236-0.256c0.091-0.096 0.177-0.201 0.254-0.311l0.006-0.009c-0.158-0.36-0.622-1.472-0.988-2.352l-0.322-0.772-0.038-0.086c-0.188-0.010-0.302-0.016-0.426-0.016zM12.462 12.442v0.012z"></path>\n</svg>\n';!function(a){a.FACEBOOK="facebook",a.TWITTER="twitter",a.WHATSAPP="whatsapp",a.EMAIL="email",a.COPY_LINK="copy_link"}(c||(c={}));const h=class{constructor(s){a(this,s),this.ignoreOutsideClick=!1,this.translationDefaults={"common.social.share":{ar:"مشاركة",en:"Share"},"common.social.email":{ar:"إيميل",en:"Email"},"common.social.whatsapp":{ar:"واتساب",en:"WhatsApp"},"common.social.twitter":{ar:"أكس",en:"X"},"common.social.facebook":{ar:"فيسبوك",en:"Facebook"},"common.social.copy":{ar:"نسخ",en:"Copy"},"common.social.copied":{ar:"تم النسخ",en:"Copied"}},this.onDocumentClick=a=>{this.ignoreOutsideClick||!this.opened||this.host.contains(a.target)||this.close()},this.opened=!1,this.copied=!1,this.allPlatforms=[c.WHATSAPP,c.FACEBOOK,c.TWITTER,c.EMAIL,c.COPY_LINK],this.platformIcons=[{icon:d,name:c.WHATSAPP},{icon:i,name:c.FACEBOOK},{icon:o,name:c.TWITTER},{icon:l,name:c.EMAIL},{icon:n,name:c.COPY_LINK}],this.convertedPlatforms=[],this.url="",this.urlName="",this.platforms="facebook,twitter,whatsapp,email,copy_link",this.mode="default",this.modalTitle=""}componentWillLoad(){if(this.registerTranslationDefaults(),this.host.hasAttribute("aria-label")&&this.host.removeAttribute("aria-label"),document.getElementById("a2a-script"))return;const a=document.createElement("script");a.src="https://static.addtoany.com/menu/page.js",a.setAttribute("id","a2a-script"),a.async=!0,a.onload=function(){window.a2a_config.locale=salla.config.get("user.language_code",salla.lang.getLocale()),window.a2a_config.callbacks=window.a2a_config.callbacks||[],window.a2a_config.callbacks.push({share:a=>{const s={share_via:a.service.toLowerCase(),url:a.url,title:a.title};salla.event.emit("share-element",s)}})},document.body.appendChild(a)}componentDidLoad(){document.addEventListener("click",this.onDocumentClick)}disconnectedCallback(){document.removeEventListener("click",this.onDocumentClick),this.copiedResetTimeout&&window.clearTimeout(this.copiedResetTimeout),this.setBodyScrollLocked(!1)}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const a=Object.entries(this.translationDefaults).reduce(((a,[s,e])=>(salla.lang.get(s)===s&&(a[s]=e),a)),{});Object.keys(a).length&&salla.lang.addBulk(a)}resolveShareKit(){return this.host.querySelector(".a2a_kit")}deferOutsideClickGuard(){this.ignoreOutsideClick=!0,requestAnimationFrame((()=>{this.ignoreOutsideClick=!1}))}async open(){if(this.opened)return;if(this.opened=!0,this.deferOutsideClickGuard(),"modal"===this.mode&&this.setBodyScrollLocked(!0),await new Promise((a=>requestAnimationFrame((()=>a())))),!this.opened)return;if(await this.refresh(),"modal"===this.mode)return;const a=this.resolveShareKit();a?(this.openAnimation=(new t.timeline).add({targets:a,translateY:[-50,0],opacity:[0,1],duration:300,podding:"0",easing:"easeInOutSine"}),this.openAnimation.add({targets:a.children,translateZ:0,translateY:[-30,0],scaleY:[0,1],opacity:[0,1],duration:1400,delay:t.stagger(100)},"-=200")):this.opened=!1}async close(){this.opened&&(this.openAnimation?.pause(),this.openAnimation?.seek(0),this.opened=!1,"modal"===this.mode&&this.setBodyScrollLocked(!1))}setBodyScrollLocked(a){document.body.classList.toggle("s-social-share-modal-is-open",a)}toggle(){return this.opened?this.close():(this.deferOutsideClickGuard(),this.open())}onUrlChanged(a,s){a!==s&&this.refresh()}getShareUrl(){return this.url||window.location.href}getModalTitle(){return this.modalTitle||salla.lang.get("common.social.share")}syncShareAttributes(){const a=this.resolveShareKit();a&&(a.setAttribute("data-a2a-url",this.getShareUrl()),a.setAttribute("data-a2a-title",this.urlName||document.title))}async refresh(){this.syncShareAttributes(),"function"!=typeof window.a2a?.init_all?window.a2a?.init("page"):window.a2a.init_all()}async copyLink(){const a=this.getShareUrl();try{await navigator.clipboard.writeText(a)}catch{const s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy")}catch{}s.remove()}salla.event.emit("share-element",{share_via:"copy_link",url:a,title:this.urlName||document.title}),this.copied=!0,this.copiedResetTimeout&&window.clearTimeout(this.copiedResetTimeout),this.copiedResetTimeout=window.setTimeout((()=>this.copied=!1),2e3)}modalPlatformMeta(a){switch(a){case c.WHATSAPP:return{icon:d,color:"#25D366",label:salla.lang.get("common.social.whatsapp")};case c.FACEBOOK:return{icon:i,color:"#1877F2",label:salla.lang.get("common.social.facebook")};case c.TWITTER:return{icon:o,color:"#000000",label:salla.lang.get("common.social.twitter")};case c.EMAIL:return{icon:l,color:"#2BA6FF",label:salla.lang.get("common.social.email")};default:return{icon:n,color:"#6b7280",label:a}}}renderModalCard(a){const e=this.modalPlatformMeta(a);return s("a",{class:`s-social-share-modal-card a2a_button_${a}`,"aria-label":`Share Via ${a}`},s("span",{class:"s-social-share-modal-icon",style:{backgroundColor:e.color},innerHTML:e.icon}),s("span",{class:"s-social-share-modal-card-label"},e.label))}renderModal(){if(!this.opened)return null;const a=this.platforms.split(",").map((a=>a.trim())),e=[c.EMAIL,c.WHATSAPP,c.TWITTER,c.FACEBOOK].filter((s=>a.includes(s))),t=a.includes(c.COPY_LINK);return s("div",{class:"s-social-share-modal",onClick:a=>{a.target===a.currentTarget&&this.close()}},s("div",{class:"s-social-share-modal-dialog",role:"dialog","aria-modal":"true"},s("div",{class:"s-social-share-modal-handle","aria-hidden":"true"}),s("div",{class:"s-social-share-modal-header"},s("span",{class:"s-social-share-modal-title"},this.getModalTitle()),s("button",{type:"button",class:"s-social-share-modal-close","aria-label":salla.lang.get("common.elements.close"),onClick:()=>this.close()},s("span",{class:"s-social-share-modal-close-icon",innerHTML:r}))),s("div",{class:"s-social-share-modal-platforms a2a_kit","data-a2a-url":this.getShareUrl(),"data-a2a-title":this.urlName?this.urlName:document.title},e.map((a=>this.renderModalCard(a)))),t&&s("div",{class:"s-social-share-modal-copy-row"},s("span",{class:"s-social-share-modal-url",dir:"ltr"},this.getShareUrl()),s("salla-button",{type:"button",fill:"outline",onClick:()=>this.copyLink()},this.copied?salla.lang.get("common.social.copied"):salla.lang.get("common.social.copy")))))}renderPopupList(){return s("ul",{class:{"s-social-share-list":!0,a2a_kit:!0,share:!0,opened:this.opened},"data-a2a-url":this.getShareUrl(),"data-a2a-title":this.urlName?this.urlName:document.title},this.platforms.split(",").map((a=>s("li",null,s("a",{class:`a2a_button_${a}`,"aria-label":`Share Via ${a}`},this.platformIcons.map((e=>{if(e.name===a)return s("span",{class:"s-social-share-icon",innerHTML:e.icon})})))))))}render(){return s("div",{key:"e934ffb94fea491d445e62f26fcf98914ff0a399",class:"s-social-share-wrapper"},s("slot",{key:"8dbf4a0c3fb6fb17a0a7c32ace57b357708c0678",name:"widget"},s("salla-button",{key:"eb6459bc99d4587bbfc6c0399003a2860d6992b0","aria-label":"Share",onClick:()=>this.toggle(),class:"s-social-share-btn",shape:"icon",fill:"outline",color:"light"},s("span",{key:"3394f64755bd0bc07839b1a513f5459c8258f096",innerHTML:this.opened?r:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>share-alt</title>\n<path d="M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}))),"modal"===this.mode?this.renderModal():this.renderPopupList())}get host(){return e(this)}static get watchers(){return{url:["onUrlChanged"]}}};h.style=":global(body.s-social-share-modal-is-open){overflow:hidden}.s-social-share-modal{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;padding:1rem;background-color:rgba(17, 24, 39, 0.5)}.s-social-share-modal-dialog{position:relative;width:100%;max-width:32rem;padding:1.5rem;background-color:#fff;border-radius:1rem;box-shadow:0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)}.s-social-share-modal-handle{display:none}.s-social-share-modal-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}.s-social-share-modal-title{font-size:1.125rem;font-weight:700;color:#1f2937}.s-social-share-modal-close{display:inline-flex;align-items:center;justify-content:center;padding:0.25rem;line-height:0;background:transparent;border:0;cursor:pointer}.s-social-share-modal-close-icon svg{width:1.25rem;height:1.25rem;fill:#ef4444}.s-social-share-modal-platforms{display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:0.75rem}.s-social-share-modal-card{display:flex;flex-direction:column;align-items:center;gap:0.5rem;padding:0.75rem;border:1px solid #e5e7eb;border-radius:0.75rem;text-decoration:none;cursor:pointer;transition:border-color 0.15s ease, box-shadow 0.15s ease}.s-social-share-modal-card:hover{border-color:#d1d5db;box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-social-share-modal-icon{display:flex;align-items:center;justify-content:center;width:3rem;height:3rem;border-radius:9999px}.s-social-share-modal-icon svg{width:1.25rem;height:1.25rem;fill:#fff}.s-social-share-modal-card-label{font-size:0.875rem;color:#4b5563}.s-social-share-modal-copy-row{display:flex;align-items:center;gap:0.75rem;margin-top:1rem;padding:0.5rem;background-color:#f3f4f6;border-radius:0.75rem}.s-social-share-modal-url{flex:1 1 auto;min-width:0;padding:0 0.5rem;font-size:0.875rem;color:#6b7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes s-social-share-sheet-in{from{transform:translateY(100%)}to{transform:translateY(0)}}@media (max-width: 640px){.s-social-share-modal{align-items:flex-end;justify-content:center;padding:0}.s-social-share-modal-dialog{max-width:none;padding:0.75rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));border-radius:1rem 1rem 0 0;box-shadow:0 -4px 24px rgba(0, 0, 0, 0.12);animation:s-social-share-sheet-in 0.28s ease-out}.s-social-share-modal-handle{display:block;width:2.5rem;height:0.25rem;margin:0 auto 0.75rem;background-color:#d1d5db;border-radius:9999px}.s-social-share-modal-header{margin-bottom:1rem}.s-social-share-modal-platforms{grid-template-columns:repeat(2, minmax(0, 1fr))}}";export{h as salla_social_share}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as i,a as e}from"./p-DJPd6DKq.js";const a=class{constructor(t){s(this,t),this.menuOpen=!1,this.hasProducts=!1,this.specificMode=!1,this.selectedIds=[],this.loadedProductCount=0,this.isSharing=!1,this.shareUrl="",this.isListSyncPaused=!1,this.translationDefaults={"pages.wishlist.share":{ar:"شارك",en:"Share"},"pages.wishlist.share_all":{ar:"مشاركة القائمة",en:"Share the list"},"pages.wishlist.share_specific":{ar:"مشاركة منتجات محددة",en:"Share specific items"},"pages.wishlist.share_list_title":{ar:"مشاركة قائمة الأمنيات",en:"Share wishlist"},"pages.wishlist.select_all":{ar:"تحديد الكل",en:"Select all"},"common.elements.cancel":{ar:"إلغاء",en:"Cancel"}},this.onSelectionChanged=s=>{this.selectedIds=s?.ids||[],this.shareUrl="",this.socialShare?.close(),this.syncLoadedProductCount()},this.onDocumentClick=s=>{this.menuOpen&&!this.host.contains(s.target)&&(this.menuOpen=!1)},this.onProductsFetched=s=>{"wishlist"===s?.source&&(this.isListSyncPaused=!1,this.syncHasProducts(!!s?.data?.length),this.syncLoadedProductCount())}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.registerTranslationDefaults(),this.loadTranslations(),Salla.event.on("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.on("salla-products-list::products.fetched",this.onProductsFetched),document.addEventListener("click",this.onDocumentClick)}componentDidLoad(){this.initPageTitleAlignment(),this.productsList=this.host.parentElement?.querySelector("salla-products-list"),this.productsList?(this.syncHasProducts(),this.productsObserver=new MutationObserver((()=>{this.syncHasProducts()})),this.productsObserver.observe(this.productsList,{childList:!0,subtree:!0})):Salla.logger?.warn?.("[salla-wishlist-actions] no sibling salla-products-list found")}disconnectedCallback(){Salla.event.off("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.off("salla-products-list::products.fetched",this.onProductsFetched),document.removeEventListener("click",this.onDocumentClick),this.productsObserver?.disconnect(),this.pageTitleObserver?.disconnect(),this.pageTitleRetryTimeout&&window.clearTimeout(this.pageTitleRetryTimeout),this.resetPageTitleAlignment()}initPageTitleAlignment(){if(this.syncPageTitleAlignment(),this.pageTitle)return;requestAnimationFrame((()=>this.syncPageTitleAlignment())),this.pageTitleRetryTimeout=window.setTimeout((()=>this.syncPageTitleAlignment()),300);const s=this.host.closest(".main-content")??this.host.parentElement;s&&!this.pageTitle&&(this.pageTitleObserver=new MutationObserver((()=>{this.pageTitle?this.pageTitleObserver?.disconnect():(this.syncPageTitleAlignment(),this.pageTitle&&this.pageTitleObserver?.disconnect())})),this.pageTitleObserver.observe(s,{childList:!0,subtree:!0}))}findPageTitle(){const s=this.host.parentElement;if(s)for(const t of Array.from(s.children)){if(t===this.host)break;if("H1"===t.tagName)return t;const s=t.querySelector("h1");if(s)return s}const t=this.host.closest(".main-content");if(t){const s=t.querySelector("h1");if(s&&!this.host.contains(s))return s}return document.querySelector(".main-content h1, main h1")}syncPageTitleAlignment(){if(this.pageTitle)return;const s=this.findPageTitle();s&&(this.pageTitle=s,s.classList.add(a.pageTitleClass))}resetPageTitleAlignment(){this.pageTitle?.classList.remove(a.pageTitleClass),this.pageTitle=void 0}registerTranslationDefaults(){const s=Object.entries(this.translationDefaults).reduce(((s,[t,i])=>(Salla.lang.get(t)===t&&(s[t]=i),s)),{});Object.keys(s).length&&Salla.lang.addBulk(s)}loadTranslations(){this.shareLabel=Salla.lang.get("pages.wishlist.share"),this.shareAllLabel=Salla.lang.get("pages.wishlist.share_all"),this.shareSpecificLabel=Salla.lang.get("pages.wishlist.share_specific"),this.selectAllLabel=Salla.lang.get("pages.wishlist.select_all"),this.cancelLabel=Salla.lang.get("common.elements.cancel"),this.shareModalTitle=Salla.lang.get("pages.wishlist.share_list_title")}get selectedCount(){return this.selectedIds.length}get isAllSelected(){return this.loadedProductCount>0&&this.selectedCount===this.loadedProductCount}get isPartiallySelected(){return this.selectedCount>0&&this.selectedCount<this.loadedProductCount}async syncLoadedProductCount(){if(!this.productsList)return void(this.loadedProductCount=0);if(this.isListSyncPaused&&this.specificMode)return;const s=await this.productsList.getLoadedProducts();this.loadedProductCount=s.length}syncSelectAllCheckboxState(){this.selectAllCheckbox&&(this.selectAllCheckbox.checked=this.isAllSelected,this.selectAllCheckbox.indeterminate=this.isPartiallySelected)}componentDidRender(){this.syncSelectAllCheckboxState()}pauseListSync(){this.isListSyncPaused=!0,window.setTimeout((()=>{this.isListSyncPaused&&(this.isListSyncPaused=!1,this.syncHasProducts())}),3e3)}async syncHasProducts(s){if(!this.isListSyncPaused||"boolean"==typeof s){if("boolean"==typeof s)this.hasProducts=s;else if(this.productsList){const s=await this.productsList.getLoadedProducts();if(0===s.length&&this.specificMode)return;this.hasProducts=s.length>0,this.loadedProductCount=s.length}else this.hasProducts=!1,this.loadedProductCount=0;this.hasProducts||(this.menuOpen=!1,this.specificMode&&await this.cancelSpecific())}}toggleMenu(){this.hasProducts&&(this.menuOpen=!this.menuOpen)}async toggleSelectAll(){this.productsList&&(this.isAllSelected?await this.productsList.clearSelection():await this.productsList.selectAll())}async shareSpecific(){this.menuOpen=!1,this.specificMode=!0,this.pauseListSync(),this.productsList&&(this.productsList.selectable=!0)}async cancelSpecific(){this.specificMode=!1,this.selectedIds=[],this.pauseListSync(),this.productsList&&(await this.productsList.clearSelection(),this.productsList.selectable=!1)}async shareAll(){this.menuOpen=!1,await this.processShare([],!0)}async shareSelected(){this.selectedCount&&await this.processShare(this.selectedIds,!1)}async processShare(s,t=!1){if((t||s?.length)&&!this.isSharing){this.isSharing=!0;try{const i=await salla.wishlist.share(s,t),e=i?.data?.url||i?.url||"";if(!e||!this.socialShare)return;this.shareUrl=e,this.socialShare.url=e,await this.socialShare.refresh(),await this.socialShare.open()}catch(s){Salla.logger?.warn?.("[salla-wishlist-actions] share failed",s)}finally{this.isSharing=!1}}}render(){return t(i,{key:"6329ecd00f2d08cd0fc485c371e98fe7984502d0"},t("div",{key:"6e24cd1109ae290196337fe3e1e05cfd074966a9",class:"s-wishlist-actions"},t("div",{key:"82c29d5b203368059c7883272c36576b19bdfd2d",class:"s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3"},t("div",{key:"3f85ad6a6e72308b71d506d2fc8687672b00ea7a",class:"s-wishlist-actions-dropdown relative"},t("salla-button",{key:"56c109a338bc9fa06aebdadb041b6587440fa71a",color:"primary",fill:"outline",type:"button",disabled:!this.hasProducts,"aria-haspopup":"true","aria-expanded":this.menuOpen?"true":"false",onClick:()=>this.toggleMenu()},t("div",{key:"f0cf0dc66dd8ce00ac878481bbf21662d1853eba",class:"flex flex-row justify-center items-center gap-2"},t("svg",{key:"3b97ef84df832a0bc1198319cc63b753da915b37",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},t("path",{key:"e8c626812dad32a5fc3165b58ce76a5c39586f09",d:"M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"})),this.shareLabel,t("svg",{key:"731093a2d4393fe53d63e96ecc48fcb4c4a360d2",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},t("path",{key:"af87c9481389b4b1e544e0ab2eac43db6c164aac",d:"M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z"})))),this.menuOpen&&t("ul",{key:"62ce5ade389fb563d2548fd94939f697dbc03d8a",class:"s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden"},t("li",{key:"7cb443687290ce4c7144b71140b68c020bb52dd4"},t("button",{key:"d55410bb2f164d267a9c21af2648fbef3fdc1928",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareAll()},this.shareAllLabel)),t("li",{key:"f921f5241b0e7b7ebb228049f84dfe3996081d92"},t("button",{key:"dbc903542086266571c21ada73d54dab62f5a3e2",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareSpecific()},this.shareSpecificLabel)))),t("salla-social-share",{key:"0e3aec575c1b4aa4cdd5bb2c61f3cc3e90687f23",class:"s-wishlist-actions-social",ref:s=>this.socialShare=s,url:this.shareUrl,mode:"modal",modalTitle:this.shareModalTitle},t("span",{key:"bafce0670b980b583398b3d1a997020298e35bed",slot:"widget",class:"s-wishlist-actions-social-anchor","aria-hidden":"true"}))),this.specificMode&&t("div",{key:"216cd3409541b0f93b26e2f2bfe256a36d0ff37b",class:"s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg"},t("label",{key:"4bf9a1cc508bfc87c229f69a7134bdefae0f9535",class:"s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer"},t("input",{key:"fbc39c6513eec5f4b1f281046b509c642ddce3db",type:"checkbox",class:"s-products-list-select-checkbox s-wishlist-actions-select-all",checked:this.isAllSelected,ref:s=>this.selectAllCheckbox=s,"aria-label":this.selectAllLabel,onChange:()=>this.toggleSelectAll()}),t("span",{key:"02ba3b818ecb802d8976734738c8042163b6cdae",class:"s-wishlist-actions-panel-title text-sm font-bold text-gray-700"},this.shareSpecificLabel," (",this.selectedCount,")")),t("div",{key:"447df46aa76c1ecb165b7680465ff6c6dfcc967d",class:"s-wishlist-actions-panel-buttons flex items-center gap-2"},t("salla-button",{key:"36a6360b83dd07d20ca7763e2f12dc93f169c645",class:"s-wishlist-actions-cancel",color:"light",fill:"outline",type:"button",onClick:()=>this.cancelSpecific()},this.cancelLabel),t("salla-button",{key:"3aa46bcd91bf605f7715fcaa5692e4ca0e8f199e",class:"s-wishlist-actions-share",color:"primary",fill:"outline",type:"button",disabled:!this.selectedCount,loading:this.isSharing,onClick:()=>this.shareSelected()},this.shareLabel)))))}get host(){return e(this)}};a.pageTitleClass="s-wishlist-actions-page-title",a.style=':host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:"";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}';export{a as salla_wishlist_actions}
|
|
4
|
+
import{r as s,h as t,H as i,a as e}from"./p-DBMDFsFH.js";const a=class{constructor(t){s(this,t),this.menuOpen=!1,this.hasProducts=!1,this.specificMode=!1,this.selectedIds=[],this.loadedProductCount=0,this.isSharing=!1,this.shareUrl="",this.isListSyncPaused=!1,this.translationDefaults={"pages.wishlist.share":{ar:"شارك",en:"Share"},"pages.wishlist.share_all":{ar:"مشاركة القائمة",en:"Share the list"},"pages.wishlist.share_specific":{ar:"مشاركة منتجات محددة",en:"Share specific items"},"pages.wishlist.share_list_title":{ar:"مشاركة قائمة الأمنيات",en:"Share wishlist"},"pages.wishlist.select_all":{ar:"تحديد الكل",en:"Select all"},"common.elements.cancel":{ar:"إلغاء",en:"Cancel"}},this.onSelectionChanged=s=>{this.selectedIds=s?.ids||[],this.shareUrl="",this.socialShare?.close(),this.syncLoadedProductCount()},this.onDocumentClick=s=>{this.menuOpen&&!this.host.contains(s.target)&&(this.menuOpen=!1)},this.onProductsFetched=s=>{"wishlist"===s?.source&&(this.isListSyncPaused=!1,this.syncHasProducts(!!s?.data?.length),this.syncLoadedProductCount())}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.registerTranslationDefaults(),this.loadTranslations(),Salla.event.on("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.on("salla-products-list::products.fetched",this.onProductsFetched),document.addEventListener("click",this.onDocumentClick)}componentDidLoad(){this.initPageTitleAlignment(),this.productsList=this.host.parentElement?.querySelector("salla-products-list"),this.productsList?(this.syncHasProducts(),this.productsObserver=new MutationObserver((()=>{this.syncHasProducts()})),this.productsObserver.observe(this.productsList,{childList:!0,subtree:!0})):Salla.logger?.warn?.("[salla-wishlist-actions] no sibling salla-products-list found")}disconnectedCallback(){Salla.event.off("salla-products-list::selection.changed",this.onSelectionChanged),Salla.event.off("salla-products-list::products.fetched",this.onProductsFetched),document.removeEventListener("click",this.onDocumentClick),this.productsObserver?.disconnect(),this.pageTitleObserver?.disconnect(),this.pageTitleRetryTimeout&&window.clearTimeout(this.pageTitleRetryTimeout),this.resetPageTitleAlignment()}initPageTitleAlignment(){if(this.syncPageTitleAlignment(),this.pageTitle)return;requestAnimationFrame((()=>this.syncPageTitleAlignment())),this.pageTitleRetryTimeout=window.setTimeout((()=>this.syncPageTitleAlignment()),300);const s=this.host.closest(".main-content")??this.host.parentElement;s&&!this.pageTitle&&(this.pageTitleObserver=new MutationObserver((()=>{this.pageTitle?this.pageTitleObserver?.disconnect():(this.syncPageTitleAlignment(),this.pageTitle&&this.pageTitleObserver?.disconnect())})),this.pageTitleObserver.observe(s,{childList:!0,subtree:!0}))}findPageTitle(){const s=this.host.parentElement;if(s)for(const t of Array.from(s.children)){if(t===this.host)break;if("H1"===t.tagName)return t;const s=t.querySelector("h1");if(s)return s}const t=this.host.closest(".main-content");if(t){const s=t.querySelector("h1");if(s&&!this.host.contains(s))return s}return document.querySelector(".main-content h1, main h1")}syncPageTitleAlignment(){if(this.pageTitle)return;const s=this.findPageTitle();s&&(this.pageTitle=s,s.classList.add(a.pageTitleClass))}resetPageTitleAlignment(){this.pageTitle?.classList.remove(a.pageTitleClass),this.pageTitle=void 0}registerTranslationDefaults(){const s=Object.entries(this.translationDefaults).reduce(((s,[t,i])=>(Salla.lang.get(t)===t&&(s[t]=i),s)),{});Object.keys(s).length&&Salla.lang.addBulk(s)}loadTranslations(){this.shareLabel=Salla.lang.get("pages.wishlist.share"),this.shareAllLabel=Salla.lang.get("pages.wishlist.share_all"),this.shareSpecificLabel=Salla.lang.get("pages.wishlist.share_specific"),this.selectAllLabel=Salla.lang.get("pages.wishlist.select_all"),this.cancelLabel=Salla.lang.get("common.elements.cancel"),this.shareModalTitle=Salla.lang.get("pages.wishlist.share_list_title")}get selectedCount(){return this.selectedIds.length}get isAllSelected(){return this.loadedProductCount>0&&this.selectedCount===this.loadedProductCount}get isPartiallySelected(){return this.selectedCount>0&&this.selectedCount<this.loadedProductCount}async syncLoadedProductCount(){if(!this.productsList)return void(this.loadedProductCount=0);if(this.isListSyncPaused&&this.specificMode)return;const s=await this.productsList.getLoadedProducts();this.loadedProductCount=s.length}syncSelectAllCheckboxState(){this.selectAllCheckbox&&(this.selectAllCheckbox.checked=this.isAllSelected,this.selectAllCheckbox.indeterminate=this.isPartiallySelected)}componentDidRender(){this.syncSelectAllCheckboxState()}pauseListSync(){this.isListSyncPaused=!0,window.setTimeout((()=>{this.isListSyncPaused&&(this.isListSyncPaused=!1,this.syncHasProducts())}),3e3)}async syncHasProducts(s){if(!this.isListSyncPaused||"boolean"==typeof s){if("boolean"==typeof s)this.hasProducts=s;else if(this.productsList){const s=await this.productsList.getLoadedProducts();if(0===s.length&&this.specificMode)return;this.hasProducts=s.length>0,this.loadedProductCount=s.length}else this.hasProducts=!1,this.loadedProductCount=0;this.hasProducts||(this.menuOpen=!1,this.specificMode&&await this.cancelSpecific())}}toggleMenu(){this.hasProducts&&(this.menuOpen=!this.menuOpen)}async toggleSelectAll(){this.productsList&&(this.isAllSelected?await this.productsList.clearSelection():await this.productsList.selectAll())}async shareSpecific(){this.menuOpen=!1,this.specificMode=!0,this.pauseListSync(),this.productsList&&(this.productsList.selectable=!0)}async cancelSpecific(){this.specificMode=!1,this.selectedIds=[],this.pauseListSync(),this.productsList&&(await this.productsList.clearSelection(),this.productsList.selectable=!1)}async shareAll(){this.menuOpen=!1,await this.processShare([],!0)}async shareSelected(){this.selectedCount&&await this.processShare(this.selectedIds,!1)}async processShare(s,t=!1){if((t||s?.length)&&!this.isSharing){this.isSharing=!0;try{const i=await salla.wishlist.share(s,t),e=i?.data?.url||i?.url||"";if(!e||!this.socialShare)return;this.shareUrl=e,this.socialShare.url=e,await this.socialShare.refresh(),await this.socialShare.open()}catch(s){Salla.logger?.warn?.("[salla-wishlist-actions] share failed",s)}finally{this.isSharing=!1}}}render(){return t(i,{key:"6329ecd00f2d08cd0fc485c371e98fe7984502d0"},t("div",{key:"6e24cd1109ae290196337fe3e1e05cfd074966a9",class:"s-wishlist-actions"},t("div",{key:"82c29d5b203368059c7883272c36576b19bdfd2d",class:"s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3"},t("div",{key:"3f85ad6a6e72308b71d506d2fc8687672b00ea7a",class:"s-wishlist-actions-dropdown relative"},t("salla-button",{key:"56c109a338bc9fa06aebdadb041b6587440fa71a",color:"primary",fill:"outline",type:"button",disabled:!this.hasProducts,"aria-haspopup":"true","aria-expanded":this.menuOpen?"true":"false",onClick:()=>this.toggleMenu()},t("div",{key:"f0cf0dc66dd8ce00ac878481bbf21662d1853eba",class:"flex flex-row justify-center items-center gap-2"},t("svg",{key:"3b97ef84df832a0bc1198319cc63b753da915b37",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},t("path",{key:"e8c626812dad32a5fc3165b58ce76a5c39586f09",d:"M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"})),this.shareLabel,t("svg",{key:"731093a2d4393fe53d63e96ecc48fcb4c4a360d2",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 32 32",style:{width:"16px",height:"16px"}},t("path",{key:"af87c9481389b4b1e544e0ab2eac43db6c164aac",d:"M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z"})))),this.menuOpen&&t("ul",{key:"62ce5ade389fb563d2548fd94939f697dbc03d8a",class:"s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden"},t("li",{key:"7cb443687290ce4c7144b71140b68c020bb52dd4"},t("button",{key:"d55410bb2f164d267a9c21af2648fbef3fdc1928",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareAll()},this.shareAllLabel)),t("li",{key:"f921f5241b0e7b7ebb228049f84dfe3996081d92"},t("button",{key:"dbc903542086266571c21ada73d54dab62f5a3e2",type:"button",class:"s-wishlist-actions-menu-item",onClick:()=>this.shareSpecific()},this.shareSpecificLabel)))),t("salla-social-share",{key:"0e3aec575c1b4aa4cdd5bb2c61f3cc3e90687f23",class:"s-wishlist-actions-social",ref:s=>this.socialShare=s,url:this.shareUrl,mode:"modal",modalTitle:this.shareModalTitle},t("span",{key:"bafce0670b980b583398b3d1a997020298e35bed",slot:"widget",class:"s-wishlist-actions-social-anchor","aria-hidden":"true"}))),this.specificMode&&t("div",{key:"216cd3409541b0f93b26e2f2bfe256a36d0ff37b",class:"s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg"},t("label",{key:"4bf9a1cc508bfc87c229f69a7134bdefae0f9535",class:"s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer"},t("input",{key:"fbc39c6513eec5f4b1f281046b509c642ddce3db",type:"checkbox",class:"s-products-list-select-checkbox s-wishlist-actions-select-all",checked:this.isAllSelected,ref:s=>this.selectAllCheckbox=s,"aria-label":this.selectAllLabel,onChange:()=>this.toggleSelectAll()}),t("span",{key:"02ba3b818ecb802d8976734738c8042163b6cdae",class:"s-wishlist-actions-panel-title text-sm font-bold text-gray-700"},this.shareSpecificLabel," (",this.selectedCount,")")),t("div",{key:"447df46aa76c1ecb165b7680465ff6c6dfcc967d",class:"s-wishlist-actions-panel-buttons flex items-center gap-2"},t("salla-button",{key:"36a6360b83dd07d20ca7763e2f12dc93f169c645",class:"s-wishlist-actions-cancel",color:"light",fill:"outline",type:"button",onClick:()=>this.cancelSpecific()},this.cancelLabel),t("salla-button",{key:"3aa46bcd91bf605f7715fcaa5692e4ca0e8f199e",class:"s-wishlist-actions-share",color:"primary",fill:"outline",type:"button",disabled:!this.selectedCount,loading:this.isSharing,onClick:()=>this.shareSelected()},this.shareLabel)))))}get host(){return e(this)}};a.pageTitleClass="s-wishlist-actions-page-title",a.style=':host{display:block}.s-wishlist-actions-menu{min-width:200px;inset-inline-end:0;inset-inline-start:auto;list-style:none;margin:0;padding:4px 0;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}.s-wishlist-actions-menu-item{display:block;width:100%;padding:10px 16px;text-align:start;font-size:0.875rem;color:#374151;background:transparent;cursor:pointer;white-space:nowrap}.s-wishlist-actions-menu-item:hover{background-color:#f3f4f6;color:var(--color-primary)}.s-wishlist-actions-panel{box-shadow:0 1px 3px rgba(0, 0, 0, 0.08)}.s-wishlist-actions-panel-select-all{user-select:none}.s-wishlist-actions-select-all:indeterminate,.s-wishlist-actions-select-all:indeterminate:hover,.s-wishlist-actions-select-all:indeterminate:focus{background-color:var(--color-primary);border-color:var(--color-primary)}.s-wishlist-actions-select-all:indeterminate::after{content:"";position:absolute;top:50%;left:50%;width:10px;height:2px;background:#fff;border:none;transform:translate(-50%, -50%)}.s-wishlist-actions-social-anchor{display:none}h1.s-wishlist-actions-page-title{text-align:start !important}';export{a as salla_wishlist_actions}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as
|
|
4
|
+
import{r as t,c as s,h as e,H as i}from"./p-DBMDFsFH.js";import{a}from"./p-BedNk7k1.js";const l=class{constructor(e){t(this,e),this.changed=s(this,"changed"),this.min=0,this.max=1e4,this.moreThanLabel="أكثر من",this.lessThanLabel="أقل من",this.toLabel="الى",this.fromLabel="من",this.typing=!1,this.isMin=!1,this.isRTL=salla.config.get("theme.is_rtl",!0),this.filterValues=[]}connectedCallback(){if(this.filtersData&&this.filtersData?.price&&(this.minPrice=this.filtersData.price.min,this.maxPrice=this.filtersData.price.max),salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel),this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel),this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel),this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)})),1==this.option.values.length)return;if(this.option.values.length<=5)return void(this.filterValues=this.option.values);const t=Math.ceil(this.option.values.length/5);for(let s=0;s<this.option.values.length;s+=t)this.filterValues.push(this.option.values.slice(s,s+t).reduce(((t,s)=>(t.to=s.to,t.count+=s.count,t))))}async reset(){this.minInput.value=null,this.maxInput.value=null,this.minPrice=null,this.maxPrice=null}getPriceLabel(t){return isNaN(t.from)||t.from<1?`${this.lessThanLabel} ${salla.money(t.to)}`:isNaN(t.to)||t.to<1?`${this.moreThanLabel} ${salla.money(t.from)}`:`${salla.money(t.from)} ${this.toLabel} ${salla.money(t.to)}`}minInputValidation(t){t&&(t>this.max||this.maxPrice&&t>this.maxPrice)||(t<this.min?this.minPrice=this.min:t&&(this.minPrice=t))}maxInputValidation(t){t&&(t<this.min||this.minPrice&&t<this.minPrice)||t>this.max&&(this.maxPrice=this.max)}async changedEventHandler(t){salla.helpers.inputDigitsOnly(this.minInput),salla.helpers.inputDigitsOnly(this.maxInput);const s=this.minPrice?1*+this.minPrice:null,e=this.maxPrice?1*+this.maxPrice:null;this.maxPrice||(this.maxPrice=""),this.isMin?this.minInputValidation(s):(this.minPrice||(this.minPrice=0),this.maxInputValidation(e)),this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}handleMinMaxPrice(t,s){this.minPrice=s.from,this.maxPrice="*"!==s.to?s.to:"",this.changedEventHandler(t)}isChecked(t){return!(!this.minPrice&&!this.maxPrice)&&(((t.from<1||"*"==t.from)&&0==this.minPrice||t.from==this.minPrice)&&("*"==t.to||!t.to||t.to==this.maxPrice))}handleMinPrice(t){this.isMin=!0;const s=t.target.value;this.minPrice=""===s?0:s}handleMaxPrice(t){this.isMin=!1;const s=t.target.value;this.maxPrice=void 0===s?"":s}render(){return e(i,{key:"ecc44cf63ea7788f00aa33a19c06579c887c59dd"},this.filterValues.map(((t,s)=>e("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${s}`,key:s},e("input",{id:`${this.option.key}-${s}`,name:"price",type:"radio",checked:this.isChecked(t),class:"s-filters-radio",onChange:s=>this.handleMinMaxPrice(s,t)}),e("span",{innerHTML:this.getPriceLabel(t)})))),e("div",{key:"c4b6d75b11a2625f429caf6bba9e0dd625f6f646",class:"flex justify-center items-center"},e("div",{key:"4e85f9c05415daf235ab965ebe185c7171f08e06",class:"relative max-w-xl w-full"},e("div",{key:"44b7747bfa4ec0e46da70dcf25f5325562bb0be9",class:"s-price-range-inputs"},e("div",{key:"08a9afa0ea579f31eba87561283162b1d47f123f",class:"s-price-range-relative"},e("div",{key:"54540065c16484f01e356fb2094f3163357ffd95",class:"s-price-range-currency"}," ",salla.config.currency().symbol),e("input",{key:"851b957d076c25808edba4e763ae31286047782f",type:"number",maxlength:"5",ref:t=>this.minInput=t,onBlur:t=>this.handleMinPrice(t),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),e("div",{key:"f8a910aca554ae21657a19115d7f9607efb0566d",class:"s-price-range-gray-text"}," -"),e("div",{key:"7d1561634459c15862bc0455b4bd9248d44a8446",class:"s-price-range-relative"},e("div",{key:"7ca1fb8056b8af71f6f57524ed9d5fdfdc641ef2",class:"s-price-range-currency"}," ",salla.config.currency().symbol),e("input",{key:"e6411b0e1b0e36b45a6879c1b257f394ec94007f",type:"number",maxlength:"5",ref:t=>this.maxInput=t,onBlur:t=>this.handleMaxPrice(t),value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),e("salla-button",{key:"63bc422c8d82c820bd984d5af68f8081add164c3",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:t=>this.changedEventHandler(t)},e("span",{key:"b81d3813cb2ff9523f232cf0a615c58576b14177",innerHTML:this.isRTL?a:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>arrow-right</title>\n<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>\n</svg>\n'}))))))}componentDidLoad(){this.isReady=!0}};l.style=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";export{l as salla_price_range}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as a,H as t,a as n}from"./p-
|
|
4
|
+
import{r as e,h as a,H as t,a as n}from"./p-DBMDFsFH.js";import{S as i}from"./p-8Tsmrwno.js";const r=class{constructor(a){e(this,a)}componentWillLoad(){this.title=salla.config.get("maintenance_details.title"),this.message=salla.config.get("maintenance_details.message");const e="undefined"!=typeof window&&!window.matchMedia("(min-width: 768px)").matches;this.buttonTitle=e?salla.config.get("maintenance_details.button_title"):salla.config.get("maintenance_details.button_full_title")}closeAlert(){salla.storage.set("hide_salla-maintenance-alert_at",Date.now()),this.host.style.display="none"}render(){return a(t,{key:"138946ca54499c6125d04ecbcaea3f578ad463d7",class:"s-maintenance-alert-wrapper"},a("button",{key:"628862a36b7265092a281e464b356e4609ab461c",class:"s-maintenance-alert-close",innerHTML:i,onClick:()=>this.closeAlert()}),a("div",{key:"159a9a144cc2c5094df87b236448f7fd14a46874",class:"s-maintenance-alert-content"},a("div",{key:"fe29a1e35330ea4f17860347b40b4860ec0345bb",class:"s-maintenance-alert-container"},a("div",{key:"7c62e34354d0a63fdadda9b26be6d2470e6dd9b1",class:"s-maintenance-alert-icon"},a("img",{key:"98d19941151c2efcae9c209177646f05ae98e708",src:salla.url.cdn("images/alert.png"),alt:"Alert"})),a("div",{key:"7b3b7ffc5e5171ba1f7f8796487ea5239b47f8e1",class:"s-maintenance-alert-text"},a("h2",{key:"c6ee28d15e5e4c9e31698973d84966127b34e5cc"},this.title),a("p",{key:"5970ed9856c0f201446a342bc4009f12f4d9ee85"},this.message))),a("div",{key:"c8c9cdea353445770a0326091bb2278d21ddbb17"},a("a",{key:"979d8db01492abaa32b67ad50e87aeabd04647f7",class:"s-maintenance-alert-btn",href:salla.config.get("maintenance_details.button_url")},this.buttonTitle))))}componentDidLoad(){let e=salla.storage.get("hide_salla-maintenance-alert_at");e&&(Date.now()-e)/1e3/60<60&&this.closeAlert()}get host(){return n(this)}};r.style=".s-maintenance-alert-wrapper{display:flex;min-height:40px;width:100%;flex-direction:row;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(26, 38, 61, var(--tw-bg-opacity));padding:0.25rem 0.5rem;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-wrapper a{transition:0.35s cubic-bezier(0.2, 1, 0.3, 1)}.s-maintenance-alert-wrapper *{color:inherit}@media (min-width: 640px){.s-maintenance-alert-wrapper{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-content{margin-top:1rem;margin-bottom:1rem;display:flex;width:100%;align-items:center;justify-content:space-between}@media (min-width: 640px){.s-maintenance-alert-content{padding-left:2rem;padding-right:2rem}}.s-maintenance-alert-container{display:flex;align-items:center}.s-maintenance-alert-icon{margin-right:1.25rem;display:none}@media (min-width: 640px){.s-maintenance-alert-icon{display:block}}.s-maintenance-alert-text h2{margin-bottom:0.5rem;font-size:0.875rem;font-weight:700;line-height:1.4}@media (min-width: 640px){.s-maintenance-alert-text h2{font-size:1.5rem;line-height:2rem}}.s-maintenance-alert-text p{margin:0px;text-align:right;font-size:10px;line-height:1.2}@media (min-width: 640px){.s-maintenance-alert-text p{text-align:center;font-size:0.75rem;line-height:1}}.s-maintenance-alert-btn{position:relative;margin-left:4px;margin-right:4px;display:inline-block;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;border-radius:0.125rem;border-width:1px;--tw-border-opacity:1;border-color:rgba(93, 213, 196, var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(93, 213, 196, var(--tw-bg-opacity));padding:0.5rem;text-align:center;vertical-align:middle;font-size:0.875rem;font-weight:400;line-height:1.4;--tw-text-opacity:1;color:rgba(255, 255, 255, var(--tw-text-opacity))}.s-maintenance-alert-btn:hover{--tw-bg-opacity:1;background-color:rgba(53, 203, 181, var(--tw-bg-opacity))}.s-maintenance-alert-btn *{pointer-events:none}[dir=rtl] .s-maintenance-alert-btn{margin-left:1.25rem;margin-right:0}@media (min-width: 640px){.s-maintenance-alert-btn{padding:0.5rem 1rem}}";export{r as salla_maintenance_alert}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as t,c as e,h as s,H as i,a as l}from"./p-DBMDFsFH.js";import{F as a}from"./p-DL4h2bc3.js";import{H as r}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";const o=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.isReady=!1,this.isInitialFetch=!0,this.filtersData={},this.appliedOpen=!0,salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset"),this.selectedTitle=salla.lang.getWithDefault("pages.categories.selected_filters","لقد اخترت")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let e={};this.filters=t.map((t=>{if(t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label,"rating"==t.key){t.type=a.VALUES;let{max:e,min:s}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=s||t<=e))}this.filtersData.variants&&t.type==a.VARIANTS&&(e.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==a.VARIANTS&&(e[t.key]=this.filtersData[t.key]);let s=new URLSearchParams(window.location.search),i=!1;for(let t of s.keys())if(t.includes("filters")){i=!0;break}if(this.isInitialFetch&&"product.index"==salla.config.get("page.slug")&&0==Object.keys(e).length&&!i){let t=window.location.href,s=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",l=t+i+"filters[category_id]="+s;e.category_id=s,window.history.pushState({path:l},"",l)}return t})),this.isInitialFetch=!1,this.filtersData=e,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[e]of t.searchParams.entries())e.startsWith("filters")&&t.searchParams.delete(e);let e=this.encodeFilters(this.filtersData),s=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=s?t.search.split("&filters")[0]+"&"+e:`?${e}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,e="filters"){const s=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i],a=e?`${e}[${i}]`:i;Array.isArray(l)?l.forEach((t=>s.push(`${a}[]=${t}`))):s.push("object"==typeof l&&null!==l?this.encodeFilters(l,a):`${a}=${l}`)}return s.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),e=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(t.get(e))}`)).join("&"),s=e?`${window.location.pathname}?${e}`:window.location.pathname;window.history.pushState({},"",s)}handleOptionChange(t,e,s){e.type===a.RANGE&&(this.filtersData[e.key]=s);let i=t.target.checked;if(e.type===a.VARIANTS)this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[e.key]=s),i||delete this.filtersData.variants[e.key];else if("radio"==t.target.type)i&&(this.filtersData[e.key]=s),i||delete this.filtersData[e.key];else if("checkbox"==t.target.type){const t=this.filtersData[e.key];this.filtersData[e.key]=Array.isArray(t)?t:null!=t?[t]:[],i?this.filtersData[e.key].push(s):this.filtersData[e.key]=this.filtersData[e.key].filter((t=>t!=s)),this.filtersData[e.key].length||delete this.filtersData[e.key]}this.filtersData={...this.filtersData},this.applyFilters()}getAppliedFilters(){const t=[],e=this.filtersData||{};for(const s of Object.keys(e)){if("variants"===s){const i=this.filters?.find((t=>t.type===a.VARIANTS));for(const l of Object.keys(e.variants||{})){const r=e.variants[l],o=i?.values?.find((t=>(t.key||t.value)==r));o&&t.push({key:s,variantKey:l,value:r,type:a.VARIANTS,groupLabel:i?.label,optionLabel:o.value})}continue}const i=this.filters?.find((t=>t.key===s));if(!i)continue;const l=e[s];if(i.type===a.RANGE||l&&"object"==typeof l&&!Array.isArray(l)){t.push({key:s,value:l,type:a.RANGE,groupLabel:i.label,optionLabel:`${l.min} - ${l.max}`});continue}if("category_id"===s&&!Array.isArray(l)&&"product.index"==salla.config.get("page.slug")&&l==salla.config.get("page.id"))continue;const r=Array.isArray(l)?l:[l];for(const e of r){const l=i.values?.find((t=>("number"==typeof t?t:t.key||t.value)==e)),a="rating"===i.key?`${e}`:l&&"number"!=typeof l?l.value:void 0;null!=a&&t.push({key:s,value:e,type:i.type,groupLabel:i.label,optionLabel:a})}}return t}removeFilter(t){if(t.type===a.VARIANTS)this.filtersData.variants&&(delete this.filtersData.variants[t.variantKey],Object.keys(this.filtersData.variants).length||delete this.filtersData.variants);else if(t.type===a.RANGE)delete this.filtersData[t.key];else{const e=this.filtersData[t.key];Array.isArray(e)?(this.filtersData[t.key]=e.filter((e=>e!=t.value)),this.filtersData[t.key].length||delete this.filtersData[t.key]):delete this.filtersData[t.key]}this.filtersData={...this.filtersData},this.applyFilters()}render(){const t=this.getAppliedFilters(),e=salla.lang.getWithDefault("common.elements.delete","Remove");return s(i,{key:"d6dacbf458eadefda7ec2b2c6845c54f553abea8"},t.length?s("div",{class:"s-filters-applied s-filters-widget-container"},s("h3",{class:"s-filters-widget-title",onClick:()=>this.appliedOpen=!this.appliedOpen},s("span",null,this.selectedTitle),s("span",{class:"s-filters-widget-plusminus "+(this.appliedOpen?"s-filters-widget-plusminus-active":"")})),s("div",{class:"s-filters-widget-content "+(this.appliedOpen?"s-filters-widget-opened":"s-filters-widget-closed")},s("div",{class:"s-filters-widget-values"},t.map((t=>s("div",{class:"s-filters-label s-filters-applied-item"},s("span",{class:"s-filters-option-name"},t.groupLabel,": ",t.optionLabel),s("button",{type:"button",class:"s-filters-applied-remove","aria-label":`${e} ${t.groupLabel}: ${t.optionLabel}`,onClick:()=>this.removeFilter(t)},s("i",{class:"sicon-cancel","aria-hidden":"true"})))))),s("div",{class:"s-filters-footer"},s("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)))):"",this.filters?.map((t=>s("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:e,value:s}})=>{this.handleOptionChange(t,e,s)}}))))}componentDidLoad(){this.isReady=!0}get host(){return l(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}.s-filters-applied-remove{pointer-events:auto !important;cursor:pointer}";export{o as salla_filters}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as e,a as l}from"./p-DJPd6DKq.js";import{A as i}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{P as o}from"./p-DY4LZmNP.js";import{W as n}from"./p-ZT7ehBBk.js";import{S as r}from"./p-8Tsmrwno.js";import{S as h}from"./p-D4oPi1Ov.js";import{S as c}from"./p-CXRKXFgT.js";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const u=class{constructor(t){s(this,t),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_points=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.items={notifications:a,orders:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_points:c,profile:m}}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(s=>this.profileUrl=this.buildProfileUrl(s))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=h),this.items.logout='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let s=Salla.storage.get("token");s||(s=""),this.profileUrl=this.buildProfileUrl(s);const t=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',t&&(this.triggerSlot=t.innerHTML,t.innerHTML=this.replaceParams(t.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_points=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(s=>{this.updateProfileState(s)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((s=>{this.updateProfileState(s)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(s){this.badges={notifications:salla.helpers.number(s.data.notifications||0),pending_orders:salla.helpers.number(s.data.pending_orders||0)},this.hasBadges=Number(s.data.pending_orders)>0||Number(s.data.notifications)>0,this.first_name=s.data.first_name,this.last_name=s.data.last_name,this.avatar=s.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(s){this.opened=!this.opened,s.stopPropagation(),this.opened&&window.addEventListener("click",this.onClickOutside)}menuItemClicked(s,t){"logout"===t&&(s.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(s){return s.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,i)}getTheHeader(){return t("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:s=>this.open(s),onKeyUp:s=>this.open(s),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(s){return"profile"===s&&this.profileUrl&&this.sallaAccountEnabled?{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"}:{href:Salla.url.get("loyalty_points"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_points"!==s||Salla.config.get("store.features").includes("loyalty-system")))return t("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":l+1===Object.entries(this.items).length}},t("a",{...this.getItemAnchorLinkAttrs(s),class:"s-user-menu-dropdown-item-link",onClick:t=>this.menuItemClicked(t,s)},t("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:e}),t("span",{class:"s-user-menu-dropdown-item-title"},this[s]),["٠","0",void 0].includes(this.badges[s])?"":t("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[s])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return t(e,null,this.is_loggedIn?this.inline?t("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t)))):t("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),t("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},t("div",{class:"s-user-menu-dropdown",onClick:s=>s.stopPropagation(),onKeyUp:s=>s.stopPropagation()},this.showHeader?t("div",{class:"s-user-menu-dropdown-header"},t("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),t("div",{class:"s-user-menu-dropdown-header-content"},t("span",null,this.hello),t("p",null,this.first_name," ",this.last_name)),t("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:r,onClick:()=>{this.opened=!1}})):"",t("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t))))))):t("slot",{name:"login-btn"},t("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:m})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(s){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(s)}`}get host(){return l(this)}};u.style="";export{u as salla_user_menu}
|
|
4
|
+
import{r as s,h as t,H as e,a as l}from"./p-DBMDFsFH.js";import{A as i}from"./p-DCZbpt2a.js";import{B as a}from"./p-D3mWkc-3.js";import{P as o}from"./p-DY4LZmNP.js";import{W as n}from"./p-ZT7ehBBk.js";import{S as r}from"./p-8Tsmrwno.js";import{S as h}from"./p-D4oPi1Ov.js";import{S as c}from"./p-CXRKXFgT.js";var m='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-circle</title>\n<path d="M16 22.964c-4.525 0-8.447 1.713-9.993 4.365-0.371 0.636-0.156 1.452 0.48 1.823s1.453 0.156 1.823-0.48c0.855-1.465 3.624-3.041 7.689-3.041s6.835 1.576 7.689 3.041c0.249 0.424 0.696 0.661 1.155 0.661 0.228 0 0.459-0.059 0.669-0.181 0.637-0.371 0.852-1.187 0.48-1.823-1.545-2.652-5.467-4.365-9.992-4.365zM22.667 13.631c0-3.676-2.991-6.667-6.667-6.667s-6.667 2.991-6.667 6.667 2.991 6.667 6.667 6.667 6.667-2.992 6.667-6.667zM12 13.631c0-2.205 1.795-4 4-4s4 1.795 4 4-1.795 4-4 4-4-1.795-4-4zM16 0.297c-8.823 0-16 7.177-16 16 0 2.941 0.821 5.831 2.373 8.357 0.252 0.411 0.689 0.636 1.137 0.636 0.239 0 0.479-0.064 0.696-0.197 0.628-0.385 0.824-1.207 0.439-1.833-1.295-2.108-1.979-4.516-1.979-6.963 0-7.352 5.981-13.333 13.333-13.333s13.333 5.981 13.333 13.333c0 2.448-0.684 4.856-1.979 6.961-0.385 0.628-0.189 1.448 0.437 1.835 0.627 0.384 1.448 0.189 1.835-0.437 1.553-2.527 2.373-5.416 2.373-8.359 0-8.823-7.177-16-16-16z"></path>\n</svg>\n';const u=class{constructor(t){s(this,t),this.accountLoading=!1,this.opened=!1,this.notifications=salla.lang.get("common.titles.notifications"),this.orders=salla.lang.get("common.titles.orders"),this.pending_orders=salla.lang.get("common.titles.pending_orders"),this.wishlist=salla.lang.get("common.titles.wishlist"),this.profile=salla.lang.get("common.titles.profile"),this.rating=salla.lang.get("common.titles.rating"),this.wallet=salla.lang.get("common.titles.wallet"),this.settings=salla.lang.get("common.titles.settings"),this.loyalty_points=salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=salla.lang.get("blocks.header.logout"),this.hello=salla.lang.get("pages.checkout.hello"),this.first_name=salla.storage.get("user.first_name")||"",this.last_name=salla.storage.get("user.last_name")||"",this.avatar=salla.storage.get("user.avatar")||salla.url.cdn("images/avatar.png",40,40),this.badges={notifications:salla.helpers.number(salla.storage.get("user.notifications")||0),pending_orders:salla.helpers.number(salla.storage.get("user.pending_orders")||0)},this.sallaAccountEnabled=!1,this.hasBadges=Number(salla.storage.get("user.pending_orders"))>0||Number(salla.storage.get("user.notifications"))>0,this.inline=!1,this.avatarOnly=!1,this.showHeader=!1,this.relativeDropdown=!1,this.showTrigger=!1,this.onClickOutside=()=>{this.opened=!1},this.OrderUpdate=0,this.items={notifications:a,orders:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>box-bankers</title>\n<path d="M28 1.333h-24c-2.205 0-4 1.795-4 4v5.333c0 0.736 0.597 1.333 1.333 1.333v14.667c0 2.205 1.795 4 4 4h21.333c2.205 0 4-1.795 4-4v-14.667c0.736 0 1.333-0.597 1.333-1.333v-5.333c0-2.205-1.795-4-4-4zM28 26.667c0 0.735-0.599 1.333-1.333 1.333h-21.333c-0.735 0-1.333-0.599-1.333-1.333v-14.667h5.333v2.667c0 1.471 1.196 2.667 2.667 2.667h8c1.471 0 2.667-1.196 2.667-2.667v-2.667h5.333zM12 14.667v-2.667h8v2.667zM29.333 9.333h-26.667v-4c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n',pending_orders:o,wishlist:n,wallet:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>wallet</title>\n<path d="M28 6.667h-24c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333h24c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-24c-2.204 0-3.999 1.793-4 3.997v18.669c0 3.676 2.991 6.667 6.667 6.667h21.333c2.205 0 4-1.795 4-4v-16c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.736-0.597 1.333-1.333 1.333h-21.333c-2.205 0-4-1.795-4-4v-14.895c0.416 0.147 0.865 0.228 1.333 0.228h24c0.736 0 1.333 0.597 1.333 1.333zM22.667 14.667c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 20c-0.736 0-1.333-0.597-1.333-1.333s0.597-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.597 1.333-1.333 1.333z"></path>\n</svg>\n',loyalty_points:c,profile:m}}async componentWillLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.loadTranslations(),this.initiate(),Salla.event.on("api::token.injected",(s=>this.profileUrl=this.buildProfileUrl(s))),this.sallaAccountEnabled=Salla.config.get("store.features")?.includes("salla-account"),this.items=this.sallaAccountEnabled?{...this.items,settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>settings</title>\n<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>\n</svg>\n'}:this.items,this.host.hasAttribute("with-rating")&&(this.items.rating=h),this.items.logout='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>send-out</title>\n<path d="M16 26.667h-9.333c-0.736 0-1.333-0.597-1.333-1.333v-18.667c0-0.736 0.597-1.333 1.333-1.333h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333h-9.333c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h9.333c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM29.231 15.491c-0.068-0.164-0.167-0.312-0.289-0.436l-5.332-5.332c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l3.057 3.059h-12.781c-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333h12.781l-3.057 3.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l5.332-5.332c0.124-0.123 0.221-0.271 0.289-0.435 0.135-0.325 0.135-0.693 0-1.019z"></path>\n</svg>\n';let s=Salla.storage.get("token");s||(s=""),this.profileUrl=this.buildProfileUrl(s);const t=this.host.querySelector('[slot="trigger"]');this.triggerSlot='<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>',t&&(this.triggerSlot=t.innerHTML,t.innerHTML=this.replaceParams(t.innerHTML))}loadTranslations(){this.notifications=Salla.lang.get("common.titles.notifications"),this.orders=Salla.lang.get("common.titles.orders"),this.pending_orders=Salla.lang.get("common.titles.pending_orders"),this.wishlist=Salla.lang.get("common.titles.wishlist"),this.profile=Salla.lang.get("common.titles.profile"),this.hello=Salla.lang.get("pages.checkout.hello"),this.rating=Salla.lang.get("common.titles.rating"),this.wallet=Salla.lang.get("common.titles.wallet"),this.settings=Salla.lang.get("common.titles.settings"),this.loyalty_points=Salla.lang.get("pages.loyalty_program.loyalty_points"),this.logout=Salla.lang.get("blocks.header.logout")}initiate(){return Salla.config.isGuest()?this.autoMountLoginModal():(this.is_loggedIn=!0,!this.inline&&(salla.url.is_page("customer.notifications")||salla.url.is_page("customer.orders.index.pending")||salla.url.is_page("customer.profile")||(Date.now()-(salla.storage.get("user.fetched_at")||0))/1e3/60>30)?this.fetchFreshProfile():void salla.event.on("profile::info.fetched",(s=>{this.updateProfileState(s)})))}autoMountLoginModal(){this.showTrigger&&(document.querySelector("salla-login-modal")||Salla.hooks.mount("body:end",document.createElement("salla-login-modal")))}fetchFreshProfile(){salla.api.token?salla.profile.api.info().then((s=>{this.updateProfileState(s)})):salla.log("trying to fetchFreshProfile before injected the token!!")}updateProfileState(s){this.badges={notifications:salla.helpers.number(s.data.notifications||0),pending_orders:salla.helpers.number(s.data.pending_orders||0)},this.hasBadges=Number(s.data.pending_orders)>0||Number(s.data.notifications)>0,this.first_name=s.data.first_name,this.last_name=s.data.last_name,this.avatar=s.data.avatar||salla.url.cdn("images/avatar.png",40,40)}async open(s){this.opened=!this.opened,s.stopPropagation(),this.opened&&window.addEventListener("click",this.onClickOutside)}menuItemClicked(s,t){"logout"===t&&(s.preventDefault(),salla.auth.logout("sall-user-menu"))}replaceParams(s){return s.replace(/\{hello\}/g,this.hello).replace(/\{first_name\}/g,this.first_name).replace(/\{last_name\}/g,this.last_name).replace(/\{avatar\}/g,this.avatar).replace(/\{icon\}/g,i)}getTheHeader(){return t("div",{class:{"s-user-menu-trigger-slot":!0,"s-user-menu-red-dot":this.hasBadges,"s-user-menu-trigger-avatar-only":this.avatarOnly},id:"trigger-slot",onClick:s=>this.open(s),onKeyUp:s=>this.open(s),innerHTML:this.replaceParams(this.triggerSlot)})}getItemAnchorLinkAttrs(s){return"profile"===s&&this.profileUrl&&this.sallaAccountEnabled?{href:this.profileUrl,target:"_blank",rel:"noopener noreferrer"}:{href:Salla.url.get("loyalty_points"===s?"loyalty":s)}}getMenuItem([s,e],l){if(("wallet"!==s||window.can_access_wallet)&&("loyalty_points"!==s||Salla.config.get("store.features").includes("loyalty-system")))return t("li",{class:{"s-user-menu-dropdown-item":!0,"s-user-menu-dropdown-item-logout":l+1===Object.entries(this.items).length}},t("a",{...this.getItemAnchorLinkAttrs(s),class:"s-user-menu-dropdown-item-link",onClick:t=>this.menuItemClicked(t,s)},t("i",{class:"s-user-menu-dropdown-item-prefix",innerHTML:e}),t("span",{class:"s-user-menu-dropdown-item-title"},this[s]),["٠","0",void 0].includes(this.badges[s])?"":t("span",{class:"s-user-menu-dropdown-item-badge"},this.badges[s])))}componentShouldUpdate(){this.opened||window.removeEventListener("click",this.onClickOutside)}render(){return t(e,null,this.is_loggedIn?this.inline?t("ul",{class:"s-user-menu-inline"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t)))):t("div",{class:{"s-user-menu-wrapper":!0,"s-user-menu-relative-dropdown":this.relativeDropdown}},this.getTheHeader(),t("div",{class:{"s-user-menu-toggler":!0,opened:this.opened}},t("div",{class:"s-user-menu-dropdown",onClick:s=>s.stopPropagation(),onKeyUp:s=>s.stopPropagation()},this.showHeader?t("div",{class:"s-user-menu-dropdown-header"},t("img",{src:this.avatar,alt:`${this.first_name} ${this.last_name}`}),t("div",{class:"s-user-menu-dropdown-header-content"},t("span",null,this.hello),t("p",null,this.first_name," ",this.last_name)),t("button",{type:"button",class:"s-user-menu-dropdown-header-close",innerHTML:r,onClick:()=>{this.opened=!1}})):"",t("ul",{class:"s-user-menu-dropdown-list"},Object.entries(this.items).map(((s,t)=>this.getMenuItem(s,t))))))):t("slot",{name:"login-btn"},t("button",{type:"button",class:"s-user-menu-login-btn",onClick:()=>salla.event.dispatch("login::open"),innerHTML:m})))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-user-menu",this),document.lazyLoadInstance?.update(this.host.querySelectorAll(".lazy"))}buildProfileUrl(s){return`${Salla.config.get("account.url","https://accounts.salla.com")}/${salla.config.get("user.language_code")}/user?store=${Salla.config.get("store.id")}&info=${encodeURIComponent(s)}`}get host(){return l(this)}};u.style="";export{u as salla_user_menu}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as
|
|
4
|
+
import{r as a,h as s,H as t,a as e}from"./p-DBMDFsFH.js";const i=class{constructor(s){if(a(this,s),this.entity="product",this.specs=[],this.download=salla.lang.get("pages.thank_you.download"),this.entityId)try{return void(this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId))}catch(a){salla.log("Bad json passed via entityId prop")}}getValue(a){if("file"===a.type)return`<a href="${a.value}" class="text-primary" target="_blank"><span class="sicon-download"></span> ${this.download}</a>`;if("url"===a.type)return`<a href="${a.value}" class="text-blue-700 underline" target="_blank">${a.value}</a>`;if("date"===a.type){const s=new Date(a.value);return`${String(s.getDate()).padStart(2,"0")}/${String(s.getMonth()+1).padStart(2,"0")}/${s.getFullYear()}`}return a.value}async componentWillLoad(){if(await salla.onReady(),!salla.config.get("store.features")?.includes("custom-fields"))return salla.logger.error("feature custom-fields is not activated");if(this.entityId||!salla.url.is_page("product.single")&&!salla.url.is_page("product.showNewUrls")||(this.entityId=salla.config.get("page.id")),!this.entityId)return salla.logger.error("can't render salla-metadata without enity-id prop!");await salla.lang.onLoaded(),this.download=salla.lang.get("pages.thank_you.download");const a=await Salla.api.metadata.fetchValues(this.entity,this.entityId);this.specs=a.data[0]?.sections}render(){if(this.specs.length)return s(t,{class:"s-metadata-wrapper"},this.specs.map((a=>s("div",{class:"s-metadata-box"},s("div",{class:"s-metadata-box-header"},s("i",{class:"sicon-list"}),a.name),a.fields.map((a=>s("div",{class:"s-metadata-row"},s("p",{class:"s-metadata-row-name"},a.name),s("p",{class:"s-metadata-row-value",innerHTML:this.getValue(a)}))))))))}get host(){return e(this)}};i.style="";export{i as salla_metadata}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as a,H as s}from"./p-
|
|
4
|
+
import{r as e,h as a,H as s}from"./p-DBMDFsFH.js";const c=class{constructor(a){e(this,a),this.translationLoaded=!1,this.icon='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>inbox</title>\n<path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>\n</svg>\n',this.alignment="left",this.iconSize="md",salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}alignmentClass(){return{"s-placeholder-wrapper":!0,"s-placeholder-align-left":"left"==this.alignment,"s-placeholder-align-center":"center"==this.alignment,"s-placeholder-align-right":"right"==this.alignment}}render(){return a(s,{key:"f2fb77ca80d28fcc5f5505f4588bef72a4a26690",class:this.alignmentClass()},a("div",{key:"b2a1b41baf2a78087fd1f41f2f7244a36eb20846",class:`s-placeholder-icon s-placeholder-icon-${this.iconSize}`,innerHTML:this.icon}),a("div",{key:"65d106c0700890b7033ffb17ad7497db11cbdc65",class:"s-placeholder-title"},a("slot",{key:"aaa421d74b1c1c7e506adaee5efd6e7e1fe367e9",name:"title"},a("span",{key:"5e8232ebceffa33a1a997faf302e66f7f7d6112d"},salla.lang.get("common.elements.no_options")))),a("div",{key:"47f7267ff9aef10baff8a5d555cd116c569790c9",class:"s-placeholder-description"},a("slot",{key:"8f54838b8258e2f2a42a0da120186a9a7b71503f",name:"description"},a("span",{key:"6a5b79c1a69449ea4cd20d96f6149dfe89425ec3"},salla.lang.get("common.errors.empty_results")))))}};c.style="";export{c as salla_placeholder}
|