@salla.sa/twilight-components 2.14.500 → 2.14.502
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/catalog-recommendations-Bzt0HRy8.js +94 -0
- package/dist/cjs/{filepond-B9PtMjXt.js → filepond-CIptScDL.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CMd-UUZx.js → filepond-plugin-file-poster-DwHNuiWd.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DpJalosf.js → filepond-plugin-file-validate-size-BMLUB-u0.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-CZjeYI0w.js → filepond-plugin-file-validate-type-DiRunNiR.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Bl6fwgrn.js → filepond-plugin-image-edit-DujWvbF5.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BeQ8iCyg.js → filepond-plugin-image-exif-orientation-CzdpRTlH.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BkGKXzOB.js → filepond-plugin-image-preview-CpEEysug.js} +1 -1
- package/dist/cjs/{functions-UaOjMOb2.js → functions-DL46a-BT.js} +1 -1
- package/dist/cjs/{index-Cd5xdrCT.js → index-CeCWRg4V.js} +6 -2
- package/dist/cjs/{index-CQPk27Eg.js → index-D7i3cgiE.js} +1 -1
- 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 +1 -1
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +70 -30
- 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-basket-gap.cjs.entry.js +269 -0
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- 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 +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- 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_2.cjs.entry.js +4 -3
- 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 +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- 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-exchange-product-card_5.cjs.entry.js +3 -3
- 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 +1 -1
- 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-cancel.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-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 +1 -1
- 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-card_2.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 +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- 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-DwUVHl1m.js → tracked-promise-DQhIwhjv.js} +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-BTiOI13l.js → vanilla-picker-DlMSPnXD.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-basket-gap/salla-basket-gap.css +3 -0
- package/dist/collection/components/salla-basket-gap/salla-basket-gap.js +306 -0
- package/dist/collection/components/salla-bought-together/salla-bought-together.js +5 -17
- package/dist/collection/components/salla-count-down/salla-count-down.js +3 -2
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +87 -7
- package/dist/collection/shared/catalog-recommendations.js +89 -0
- package/dist/components/catalog-recommendations.js +91 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-basket-gap.d.ts +11 -0
- package/dist/components/salla-basket-gap.js +402 -0
- package/dist/components/salla-bought-together.js +5 -17
- package/dist/components/salla-count-down2.js +3 -2
- package/dist/components/salla-quick-buy2.js +66 -12
- package/dist/esm/catalog-recommendations-9fzJJ_Ox.js +91 -0
- package/dist/esm/{filepond-DjtqIoeD.js → filepond--jRYda4S.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CFxoEHLP.js → filepond-plugin-file-poster-CckDj7tB.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BnBRYL0y.js → filepond-plugin-file-validate-size-9b6v_l6Z.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-Dr5ofT9v.js → filepond-plugin-file-validate-type-CjGNB5Pv.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DyMeCzTZ.js → filepond-plugin-image-edit-UIthhs_A.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-ngtve06j.js → filepond-plugin-image-exif-orientation-DPcDqfwl.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-aqxBqAYf.js → filepond-plugin-image-preview-BWlnovlW.js} +1 -1
- package/dist/esm/{functions-Drikk4uf.js → functions-Vnk4zyHS.js} +1 -1
- package/dist/esm/{index-DuoSRdS5.js → index-BOjfFBGe.js} +6 -2
- package/dist/esm/{index-CaZkz-p0.js → index-D8XjJYaY.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 +1 -1
- package/dist/esm/salla-add-product-button_5.entry.js +70 -30
- 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-basket-gap.entry.js +267 -0
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- 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 +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- 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_2.entry.js +4 -3
- 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 +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- 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-exchange-product-card_5.entry.js +3 -3
- 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 +1 -1
- 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-cancel.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-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- 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-card_2.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- 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-CUM6cNiF.js → tracked-promise-DPZbMaax.js} +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-kF8Cgi5q.js → vanilla-picker-Db2JkkPK.js} +1 -1
- package/dist/twilight/{p-74cac8a8.entry.js → p-0076e440.entry.js} +1 -1
- package/dist/twilight/{p-c3530e7a.entry.js → p-0245e2c0.entry.js} +1 -1
- package/dist/twilight/{p-00d73870.entry.js → p-05533207.entry.js} +1 -1
- package/dist/twilight/{p-a5eeb082.entry.js → p-0809ec4c.entry.js} +1 -1
- package/dist/twilight/{p-404d3645.entry.js → p-0846a39c.entry.js} +1 -1
- package/dist/twilight/{p-0604eb27.entry.js → p-0a36a8df.entry.js} +1 -1
- package/dist/twilight/{p-2c4f4539.entry.js → p-0c4b50a8.entry.js} +1 -1
- package/dist/twilight/{p-9a161a84.entry.js → p-145f51a4.entry.js} +1 -1
- package/dist/twilight/{p-a1d3a45f.entry.js → p-16060f64.entry.js} +1 -1
- package/dist/twilight/{p-cd65e560.entry.js → p-16407a84.entry.js} +1 -1
- package/dist/twilight/{p-ca0a62f9.entry.js → p-166287b8.entry.js} +1 -1
- package/dist/twilight/{p-2104f800.entry.js → p-1ad1e565.entry.js} +1 -1
- package/dist/twilight/{p-92d37b3e.entry.js → p-1d7a5517.entry.js} +1 -1
- package/dist/twilight/{p-ca52add5.entry.js → p-2495ba63.entry.js} +1 -1
- package/dist/twilight/{p-95d8a11b.entry.js → p-24af33da.entry.js} +1 -1
- package/dist/twilight/p-24cdca69.entry.js +4 -0
- package/dist/twilight/{p-4fb48be8.entry.js → p-25be867c.entry.js} +1 -1
- package/dist/twilight/{p-0daa8221.entry.js → p-27ed0bb7.entry.js} +1 -1
- package/dist/twilight/{p-d3a9573e.entry.js → p-2f0b08a4.entry.js} +1 -1
- package/dist/twilight/{p-a34c031b.entry.js → p-3075687f.entry.js} +1 -1
- package/dist/twilight/{p-0a1f28c9.entry.js → p-3330e9b1.entry.js} +1 -1
- package/dist/twilight/{p-1d75fdd9.entry.js → p-3431ad47.entry.js} +1 -1
- package/dist/twilight/{p-dc6b3dfb.entry.js → p-36d820e1.entry.js} +1 -1
- package/dist/twilight/{p-d8c9d454.entry.js → p-3ed4357e.entry.js} +1 -1
- package/dist/twilight/{p-72291ad7.entry.js → p-3f137515.entry.js} +1 -1
- package/dist/twilight/{p-67d7bd8b.entry.js → p-404e7d5b.entry.js} +1 -1
- package/dist/twilight/{p-b0437615.entry.js → p-45b6ec5f.entry.js} +1 -1
- package/dist/twilight/{p-2c9c0815.entry.js → p-490e83b7.entry.js} +1 -1
- package/dist/twilight/{p-99ff235e.entry.js → p-4a9fbb6e.entry.js} +1 -1
- package/dist/twilight/{p-d39bf8b5.entry.js → p-4cf257b2.entry.js} +1 -1
- package/dist/twilight/{p-0c1721e1.entry.js → p-4d32ef06.entry.js} +1 -1
- package/dist/twilight/{p-74e009df.entry.js → p-5259181e.entry.js} +1 -1
- package/dist/twilight/{p-f8d642b2.entry.js → p-534c5ce0.entry.js} +1 -1
- package/dist/twilight/{p-d54b75de.entry.js → p-540b7c0c.entry.js} +1 -1
- package/dist/twilight/{p-9e27778a.entry.js → p-5492fef2.entry.js} +1 -1
- package/dist/twilight/{p-0b814320.entry.js → p-558eef65.entry.js} +1 -1
- package/dist/twilight/{p-be973f87.entry.js → p-56c55c15.entry.js} +1 -1
- package/dist/twilight/{p-7df52f7b.entry.js → p-5804914e.entry.js} +1 -1
- package/dist/twilight/p-591dc47b.entry.js +4 -0
- package/dist/twilight/{p-7b9ed1e4.entry.js → p-5cbeee21.entry.js} +1 -1
- package/dist/twilight/{p-01636f53.entry.js → p-5f0565be.entry.js} +1 -1
- package/dist/twilight/{p-92ec265b.entry.js → p-5f3b36fe.entry.js} +1 -1
- package/dist/twilight/{p-51bc9c4d.entry.js → p-628fb2e7.entry.js} +1 -1
- package/dist/twilight/{p-ae83c325.entry.js → p-62d4e685.entry.js} +1 -1
- package/dist/twilight/{p-5fe29fcf.entry.js → p-648704dc.entry.js} +1 -1
- package/dist/twilight/{p-9196b7a9.entry.js → p-67d5bded.entry.js} +1 -1
- package/dist/twilight/{p-19c6d83a.entry.js → p-6bdbd0f3.entry.js} +1 -1
- package/dist/twilight/{p-5a215130.entry.js → p-71d90a27.entry.js} +1 -1
- package/dist/twilight/{p-56ba7f94.entry.js → p-73acf48f.entry.js} +1 -1
- package/dist/twilight/{p-9cc2e54c.entry.js → p-7460706e.entry.js} +1 -1
- package/dist/twilight/{p-39389b31.entry.js → p-7ab7f179.entry.js} +1 -1
- package/dist/twilight/{p-aed6d4eb.entry.js → p-7be94cc2.entry.js} +1 -1
- package/dist/twilight/{p-286d9ba3.entry.js → p-7d10ae17.entry.js} +1 -1
- package/dist/twilight/{p-5cb10852.entry.js → p-7ef4cd2e.entry.js} +1 -1
- package/dist/twilight/{p-f5ac65b4.entry.js → p-85333282.entry.js} +1 -1
- package/dist/twilight/{p-c6b82041.entry.js → p-8e298b27.entry.js} +1 -1
- package/dist/twilight/{p-a2e8a9d1.entry.js → p-9018a13b.entry.js} +1 -1
- package/dist/twilight/{p-953da0b5.entry.js → p-91853c93.entry.js} +1 -1
- package/dist/twilight/{p-15c3b0cc.entry.js → p-95e6774b.entry.js} +1 -1
- package/dist/twilight/{p-77d816b8.entry.js → p-980deae9.entry.js} +1 -1
- package/dist/twilight/{p-0e6a0989.entry.js → p-9b9eb649.entry.js} +1 -1
- package/dist/twilight/p-9fzJJ_Ox.js +4 -0
- package/dist/twilight/p-B-m0e6tL.js +4 -0
- package/dist/twilight/{p-lYj74H1f.js → p-B93EBMau.js} +1 -1
- package/dist/twilight/{p-Ca84RIBI.js → p-BI-CCdbp.js} +1 -1
- package/dist/twilight/{p-DuoSRdS5.js → p-BOjfFBGe.js} +1 -1
- package/dist/twilight/{p-DQXp-sN5.js → p-BTd4Mp32.js} +1 -1
- package/dist/twilight/{p-BYpv9A8D.js → p-Bdy-19kn.js} +1 -1
- package/dist/twilight/{p-DYcV7UW8.js → p-Be0gsl2J.js} +1 -1
- package/dist/twilight/{p-KZ7SFw0C.js → p-BeJV4WrP.js} +1 -1
- package/dist/twilight/{p-DYgnIxqR.js → p-BsrZms1J.js} +1 -1
- package/dist/twilight/{p-kflOqry6.js → p-CIW_DqnB.js} +1 -1
- package/dist/twilight/{p-DMHhYV48.js → p-CZFiZZq_.js} +1 -1
- package/dist/twilight/{p-CHOv1Smw.js → p-CkIv9zJH.js} +1 -1
- package/dist/twilight/{p-061fdc55.entry.js → p-a38b58ca.entry.js} +1 -1
- package/dist/twilight/{p-47c9e882.entry.js → p-a60c4d82.entry.js} +1 -1
- package/dist/twilight/{p-3c96d5af.entry.js → p-a6a3a2af.entry.js} +1 -1
- package/dist/twilight/{p-eb2e3e67.entry.js → p-a8683925.entry.js} +1 -1
- package/dist/twilight/{p-04fadfb3.entry.js → p-a9dd59e6.entry.js} +1 -1
- package/dist/twilight/{p-98186fb3.entry.js → p-ae1d9d25.entry.js} +1 -1
- package/dist/twilight/{p-e5c2df5a.entry.js → p-aec3c134.entry.js} +1 -1
- package/dist/twilight/{p-f9a3f3f4.entry.js → p-b879c791.entry.js} +1 -1
- package/dist/twilight/{p-bd2672ee.entry.js → p-b8875211.entry.js} +1 -1
- package/dist/twilight/{p-4fff03a8.entry.js → p-b9d30af2.entry.js} +1 -1
- package/dist/twilight/{p-5f47eb12.entry.js → p-bb4774ef.entry.js} +1 -1
- package/dist/twilight/{p-6e535738.entry.js → p-bd3b3b56.entry.js} +1 -1
- package/dist/twilight/{p-72c9cd44.entry.js → p-bf22b091.entry.js} +1 -1
- package/dist/twilight/{p-9c798a1a.entry.js → p-c23d9868.entry.js} +1 -1
- package/dist/twilight/{p-90d53c9b.entry.js → p-c2fd3800.entry.js} +1 -1
- package/dist/twilight/p-c3598ac9.entry.js +4 -0
- package/dist/twilight/{p-c6d64b53.entry.js → p-cbe499ec.entry.js} +1 -1
- package/dist/twilight/{p-ecdf7027.entry.js → p-cdc167c6.entry.js} +1 -1
- package/dist/twilight/{p-022343f3.entry.js → p-d3807e1d.entry.js} +1 -1
- package/dist/twilight/{p-f9912293.entry.js → p-d3a91c42.entry.js} +1 -1
- package/dist/twilight/{p-d49130fc.entry.js → p-d4242231.entry.js} +1 -1
- package/dist/twilight/p-d454c6ac.entry.js +4 -0
- package/dist/twilight/{p-a96e5e06.entry.js → p-d86136e7.entry.js} +1 -1
- package/dist/twilight/{p-8658fefd.entry.js → p-dfc06251.entry.js} +1 -1
- package/dist/twilight/{p-930ff69a.entry.js → p-e033c3ad.entry.js} +1 -1
- package/dist/twilight/{p-03db477f.entry.js → p-e416ee2b.entry.js} +1 -1
- package/dist/twilight/{p-7e730733.entry.js → p-ef0ff326.entry.js} +1 -1
- package/dist/twilight/{p-f4eba1d1.entry.js → p-f00e25a1.entry.js} +1 -1
- package/dist/twilight/{p-0bc04e3f.entry.js → p-f5a960be.entry.js} +1 -1
- package/dist/twilight/{p-168e3ad8.entry.js → p-f6623828.entry.js} +1 -1
- package/dist/twilight/{p-54e43314.entry.js → p-fb79a1b4.entry.js} +1 -1
- package/dist/twilight/{p-f060a3dd.entry.js → p-fb8e031a.entry.js} +1 -1
- package/dist/twilight/{p-bdda14f6.entry.js → p-fd53f57a.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-basket-gap/salla-basket-gap.d.ts +52 -0
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +20 -0
- package/dist/types/components.d.ts +43 -0
- package/dist/types/shared/catalog-recommendations.d.ts +2 -0
- package/package.json +5 -5
- package/dist/twilight/p-25ZR4Fc8.js +0 -4
- package/dist/twilight/p-2985e01e.entry.js +0 -4
- package/dist/twilight/p-931c44fb.entry.js +0 -4
- package/dist/twilight/p-982ccb80.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,c as e,h as r,H as s}from"./p-DuoSRdS5.js";import{c as t,b as l,f as o}from"./p-DYcV7UW8.js";import{S as d}from"./p-CXRKXFgT.js";import{S as i}from"./p-cgSL_BIo.js";import{S as c}from"./p-BZp0rKEO.js";import{S as n}from"./p-8Tsmrwno.js";import{T as p}from"./p-25ZR4Fc8.js";const m=class{constructor(r){a(this,r),this.loyaltyProductExchange=e(this,"loyaltyProductExchange")}componentWillLoad(){this.hasCustomCard=!!customElements.get("custom-salla-product-card")}render(){const a="string"==typeof this.product?JSON.parse(this.product):this.product;return r("div",{key:"1a430e79a1b3099353f4e9905930f083ff889def",class:"s-loyalty-exchange-card"},this.hasCustomCard?r("custom-salla-product-card",{product:a,hideAddBtn:!0}):r("salla-product-card",{"hide-add-btn":!0,product:a}),r("div",{key:"8b75d06c112af988c149b374fdd3592cd27cb490",class:"s-loyalty-exchange-card-btn"},r("salla-button",{key:"b04dc80d5af75461a5d1f938c45bf156e4592e1e",fill:"outline",width:"wide",onClick:()=>this.loyaltyProductExchange.emit({productId:a.id})},salla.lang.get("pages.loyalty_program.redeem_reward"))))}};m.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const y=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.isClickable=()=>!0,this.isShopNow=a=>!!(salla.config.get("store.features")||[]).includes("loyalty-system-v2")&&"free_product"===a.key?.toLowerCase(),this.handleClick=a=>{salla.config.isGuest()?t((()=>salla.event.dispatch("login::open"))):this.actionClick.emit(a)}}render(){return this.isClickable(this.prize)?r("div",{class:"s-loyalty-program-rewards-modal-action"},this.isShopNow(this.prize)?r("salla-button",{fill:"outline",color:"light",class:"s-loyalty-program-rewards-action-base",onClick:()=>t()},salla.lang.get("common.elements.cancel")):r("button",{onClick:this.handleClick,class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.redeem_reward"))):null}};y.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const g=class{constructor(r){a(this,r),this.areaClick=e(this,"areaClick"),this.actionClick=e(this,"actionClick")}render(){return r(s,{key:"b63690e8c960ef4c33cd2510775e80fa06a39b82",class:"s-loyalty-program-reward-host"},r("div",{key:"1b5b2a02f13b30e70c38323328cf8862f0f4ba8f",class:"s-loyalty-program-reward-container"},r("div",{key:"0a35ac9e2d87f2d6c228fbb547e1842bd2243512",onClick:a=>this.areaClick.emit(a),role:"button"},r("div",{key:"aa2e1b5ce4e4fd186df5ad3fc25dc3fa3ccbb0fd",class:"s-loyalty-program-reward-img"},r("img",{key:"ecff4f5c86db5742910eaf402768422b93c001c3",alt:"",src:this.prize.image||salla.url.cdn("images/s-empty.png"),class:"s-loyalty-program-rewards-img"})),r("div",{key:"39216ef7e75a83770ba883e03aa26b39912292f6",class:"s-loyalty-program-reward-content"},r("div",{key:"047544aeaac2ac45e8782d11e6f08691f10864da",class:"s-loyalty-program-reward-points"},r("salla-badge",{key:"9564bdd0494ccb1812d30518384ede3b914edce4",size:"xs"},r("span",{key:"2a3ecf06e9475b0a2d6bff174b46ee15646312d5",innerHTML:d}),r("span",{key:"776d694e330d57366c084aa321845e964825cfe9",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),r("div",{key:"05e322f1a272ca223d431905c9566cc57af9e8b4",class:"s-loyalty-program-reward-title"},r("span",{key:"b3699e555190bb1c45c14a46c2c16a620ebcd9af"},this.prize.group_title)),r("div",{key:"fbdac88e90edf90ee1c6d7c66add35d28141ad36",class:"s-loyalty-program-reward-name"},r("div",{key:"5f2b92831df7628b390921098cd84849b9f13a4d",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name,this.prize.description?`: ${this.prize.description}`:"")))),r("div",{key:"f0f23a84cd12ba830212df2bee319f1e05bc5752",class:"p-4"},r("slot",{key:"33e3a2e4fe99e3db9300b69b14cba240e1c9b4de",name:"action"},r("button",{key:"70f128d1ebaba775b9cd5848f043abf9f5f8163f",onClick:a=>this.actionClick.emit(a.detail),class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-on"},salla.lang.get("pages.loyalty_program.show_reward"))))))}};g.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";var h=function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);return l>3&&o&&Object.defineProperty(e,r,o),o};const f=(...a)=>a.map((a=>"s-loyalty-program-"+a)).join(" "),u=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.productActionClick=e(this,"productActionClick"),this.refreshKey=Date.now(),this.includedProductsData=[]}handleProductExchange(a){this.productActionClick.emit({productId:a.detail.productId})}handlePrizeChange(){this.refreshKey=Date.now(),this.fetchIncludedProducts()}componentWillLoad(){"idle"===this.category.status&&this.category(),"idle"===this.brand.status&&this.brand(),this.fetchIncludedProducts()}async fetchIncludedProducts(){this.includedProductsData=[];const a=this.prize?.included_product_ids;if(!a?.length)return;const e=this.prize;try{const r=await salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:a})));this.prize===e&&(this.includedProductsData=r.data||[])}catch{this.includedProductsData=[]}}getTermsAndConditions(){const a=Number((this.prize.order_minimum_amount||"0").split(".")[0])||0,e=Number((this.prize.coupon_maximum_amount||"0").split(".")[0])||0,r=[];return a&&r.push([salla.lang.get("pages.loyalty_program.order_minimum_amount"),`${a} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),e&&r.push([salla.lang.get("pages.loyalty_program.coupon_maximum_amount"),`${e} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),r}findItems(a){return a?.length?this.brand.data.concat(this.category.data).filter((e=>a.includes(e.id_))):[]}getIncludedItems(a,e){return a?.length?a:e?.length?this.findItems(e):[]}getProductIds(a){return a||[]}getItemsMarkers(a){return"both"===a?this.getItemsMarkers("included")+this.getItemsMarkers("excluded"):[this.prize[`${a}_product_ids`]?.length||0,this.prize[`${a}_brand_ids`]?.length||0,this.prize[`${a}_category_ids`]?.length||0].map(Boolean).map(Number).join("")}getItemsMarkersText(){if("FREE_SHIPPING"===this.prize.key)return salla.lang.get("pages.loyalty_program.redeem_for_free_shipping");switch(this.getItemsMarkers("included")){case"001":default:return salla.lang.get("pages.loyalty_program.redeem_on_specific_products");case"010":return salla.lang.get("pages.loyalty_program.redeem_on_specific_brands");case"100":return salla.lang.get("pages.loyalty_program.redeem_on_specific_categories");case"000":return salla.lang.get("pages.loyalty_program.redeem_on_all_products")}}getCategoriesJsx(a,e){return a.length?r("div",{class:f("reward-details-categories-wrapper")},r("div",{class:f("reward-details-categories")},r("h2",{class:f("reward-details-categories-heading")},e),r("ul",{class:f("reward-details-categories-list")},a.map((a=>r("li",null,r("a",{href:a.urls?.customer||a.url||a.lingual_urls?.[0],class:f("reward-details-categories-item")},r("span",{innerHTML:i}),r("span",{class:f("reward-details-categories-item-content")},a.name)))))))):""}getBrandsJsx(a,e){return a.length?r("div",{class:f("reward-details-items-brands","slider-arrows-edges")},r("div",null,r("h2",null,e),r("salla-slider",{id:`brands-${a.map((({id:a})=>a)).join("-")}`,"slider-config":'{"loop":false,"slidesPerView":"auto","spaceBetween":10}'},r("div",{slot:"items"},a.map((a=>r("a",{href:salla.url.get(l(a)),class:f("reward-brand-item")},r("img",{src:a.logo||salla.url.cdn("images/s-empty.png"),alt:""})))))))):""}getProductsJsx(a,e){return a?.length?r("div",{class:"s-loyalty-program-reward-details-items-products s-loyalty-program-slider-arrows-edges"},r("h2",null,e),r("salla-products-slider",{source:"selected",sourceValue:JSON.stringify(a),"slider-config":'{"loop":false,"slidesPerView":"auto","freeMode":true,"spaceBetween":0,"breakpoints":{"768":{"slidesPerView":3,"freeMode":false,"speed":300}}}'})):""}getIncludedProductsJsx(a){const e=this.includedProductsData;return e?.length?r("div",{class:f("reward-details-items-products")},r("h2",null,a),r("div",{class:f("reward-details-products-grid")},e.map((a=>r("salla-loyalty-exchange-product-card",{product:a}))))):""}render(){const a=this.getTermsAndConditions();return r("div",{key:"08f402196aa5268a8bbf1dba1e037c45c33ae8a5",class:"s-loyalty-program-reward-modal"},r("div",{key:"75ae87a6055125371003a6bfd4e3f94c4a462c08",class:"s-loyalty-program-points-modal-header"},r("h1",{key:"4296046ef1409ec92c95e37fbea65506fb37929c",class:"s-loyalty-program-points-modal-info"},salla.url.is_page("cart")?r("button",{class:"s-loyalty-program-back-btn",onClick:()=>t((()=>salla.event.dispatch("modal::open","loyalty-rewards-modal")))},r("span",{class:{"sicon-arrow-right":"rtl"===document.documentElement.getAttribute("dir"),"sicon-arrow-left":"ltr"===document.documentElement.getAttribute("dir")}})):"",this.prize.name)),r("div",{key:"b6fd9d5a010059e928321acf5b6e904044b20513",class:"s-loyalty-program-modal-scrollable-content"},r("div",{key:"ed9572e46bb3d0ebd71a7b8eeb363433024cefbd",class:"s-loyalty-program-reward-details-header"},r("div",{key:"016fa0be4fd911293dc5a9f9f239398eae863c3f",class:"s-loyalty-program-aspect-container"},r("img",{key:"365a070a815b146dd92e2f6ca163d240c48ea862",src:this.prize.image,alt:this.prize.name})),r("salla-badge",{key:"510102d16996e3e0da9daaf6da2ab219c05e3978",size:"sm",bg:"light"},r("span",{key:"2179f7c46fadf1b5f0c030439347714a689781a4",innerHTML:d}),r("span",{key:"99a756bc4f7c6e03207a1c0d3364814c036e284b",class:"s-loyalty-program-points-badge-points"},o(this.prize.cost_points)))),a.length?r("div",{class:"s-loyalty-program-terms-and-conditions"},r("h1",{class:"s-loyalty-program-terms-and-conditions-heading"},salla.lang.get("pages.loyalty_program.terms_and_conditions")),r("ul",{class:"s-loyalty-program-terms-and-conditions-list"},a.map((([a,e])=>r("li",{class:"s-loyalty-program-terms-and-conditions-item"},r("span",{class:"s-loyalty-program-terms-and-conditions-content"},a),r("span",{class:"s-loyalty-program-terms-and-conditions-content"},e)))))):"",r("div",{key:"a4e7a863b7b7f9fad0c98a0ed0882bd5db4081c3",class:"s-loyalty-program-reward-info-message"},r("h1",{key:"ef8b9e64808bdf59f8bedf74f912ef07a92c3318",class:"s-loyalty-program-reward-info-message-heading"},salla.lang.get("pages.loyalty_program.how_to_benefit_from_this_reward")),r("p",{key:"8777469b48d9c65b33d73d3dc510397f7255641e",class:"s-loyalty-program-reward-info-message-content"},this.getItemsMarkersText())),"FREE_SHIPPING"===this.prize.key||"000000"===this.getItemsMarkers("both")?"":r("div",{class:"s-loyalty-program-reward-details"},r("salla-tabs",{key:this.refreshKey},"000"===this.getItemsMarkers("included")?"":[r("salla-tab-header",{slot:"header",name:"included",style:{display:"000"===this.getItemsMarkers("excluded")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:c}),r("span",null,salla.lang.get("pages.loyalty_program.included"))),r("salla-tab-content",{slot:"content",name:"included"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.categories,this.prize.included_category_ids),salla.lang.get("pages.loyalty_program.included_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.brands,this.prize.included_brand_ids),salla.lang.get("pages.loyalty_program.included_brands")),this.getIncludedProductsJsx(salla.lang.get("pages.loyalty_program.included_products"))))],"000"===this.getItemsMarkers("excluded")?"":[r("salla-tab-header",{slot:"header",name:"excluded",style:{display:"000"===this.getItemsMarkers("included")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:n}),r("span",null,salla.lang.get("pages.loyalty_program.excluded"))),r("salla-tab-content",{slot:"content",name:"excluded"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.excludedCategories,this.prize.excluded_category_ids),salla.lang.get("pages.loyalty_program.excluded_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.excludedBrands,this.prize.excluded_brand_ids),salla.lang.get("pages.loyalty_program.excluded_brands")),this.getProductsJsx(this.getProductIds(this.prize.excluded_product_ids),salla.lang.get("pages.loyalty_program.excluded_products"))))]))),r("salla-reward-action",{key:"aaad339124dd3e8fcac568540d627d6105712d2f",onActionClick:a=>this.actionClick.emit(a.detail),prize:this.prize}))}static get watchers(){return{prize:["handlePrizeChange"]}}};h([p((async()=>(await salla.product.api.categories()).data),{initialData:[]})],u.prototype,"category",void 0),h([p((async()=>(await salla.api.request("/brands")).data),{initialData:[]})],u.prototype,"brand",void 0),u.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const b=class{constructor(e){a(this,e),this.productId=null}reset(a=0){setTimeout((()=>{t()}),a)}getApiErrorMessage(a){return a?.response?.data?.error?.message||a?.response?.data?.message||("string"==typeof a?a:null)||salla.lang.get("common.errors.error_occurred")}async handleConfirm(){try{await this.exchange(this.prize.id,null,this.productId),this.reset(300)}catch(a){salla.notify.error(this.getApiErrorMessage(a))}}handleCancel(){this.reset(0)}render(){return r(s,{key:"98f0ce7506f94fc6c9c5dd881791d7298daa0e0b"},r("div",{key:"72661d140a8dd7b6fe8b68a120ba00f951aeb6e4",class:"s-loyalty-program-exchange-heading"},r("div",{key:"dfad67d7df6e3fde30c463791eb45ae5b356fc96",class:"s-loyalty-program-circle-base s-loyalty-program-circle-size-xl s-loyalty-program-circle-variant-fill"},r("span",{key:"04d0832e50209a87605cf016d0a462640d6379ed",innerHTML:d})),r("h2",{key:"bf7282fbb2cfb9675c0c219d65c090a95e0177f3"},salla.lang.get("pages.loyalty_program.redeem_reward")),r("p",{key:"551233696f0b1a5b8d233bcbd618e8c6f65e9bf6"},salla.lang.get("pages.loyalty_program.redeem_confirmation")," ",r("span",{key:"780e095949141888f02d165c44a648d6569ee56a"},"(",this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.point"),")")," ",salla.lang.get("pages.loyalty_program.for")," ",r("span",{key:"fac6c243a373833091bbd276d7f416c04f89abb7"},"(",this.prize.name,")"))),r("div",{key:"f806352839b2914570ee4331d3412224533cc1ca",class:"s-loyalty-program-exchange-btns"},r("salla-button",{key:"12a4c1d19a6f1ad7ac5acf09a4861b708f25fa42",width:"wide",loading:"pending"===this.exchange.status,onClick:()=>this.handleConfirm()},salla.lang.get("common.elements.confirm")),r("salla-button",{key:"5caa8e6cec4b4fc8f4968742d7de26282cb26c35",width:"wide",fill:"outline",color:"danger",onClick:()=>this.handleCancel()},salla.lang.get("common.elements.cancel"))))}};(function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);l>3&&o&&Object.defineProperty(e,r,o)})([p((async(...a)=>await salla.loyalty.exchange(...a)))],b.prototype,"exchange",void 0),b.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";export{m as salla_loyalty_exchange_product_card,y as salla_reward_action,g as salla_reward_card,u as salla_reward_details,b as salla_reward_exchange}
|
|
4
|
+
import{r as a,c as e,h as r,H as s}from"./p-BOjfFBGe.js";import{c as t,b as l,f as o}from"./p-Be0gsl2J.js";import{S as d}from"./p-CXRKXFgT.js";import{S as i}from"./p-cgSL_BIo.js";import{S as c}from"./p-BZp0rKEO.js";import{S as n}from"./p-8Tsmrwno.js";import{T as p}from"./p-B-m0e6tL.js";const m=class{constructor(r){a(this,r),this.loyaltyProductExchange=e(this,"loyaltyProductExchange")}componentWillLoad(){this.hasCustomCard=!!customElements.get("custom-salla-product-card")}render(){const a="string"==typeof this.product?JSON.parse(this.product):this.product;return r("div",{key:"1a430e79a1b3099353f4e9905930f083ff889def",class:"s-loyalty-exchange-card"},this.hasCustomCard?r("custom-salla-product-card",{product:a,hideAddBtn:!0}):r("salla-product-card",{"hide-add-btn":!0,product:a}),r("div",{key:"8b75d06c112af988c149b374fdd3592cd27cb490",class:"s-loyalty-exchange-card-btn"},r("salla-button",{key:"b04dc80d5af75461a5d1f938c45bf156e4592e1e",fill:"outline",width:"wide",onClick:()=>this.loyaltyProductExchange.emit({productId:a.id})},salla.lang.get("pages.loyalty_program.redeem_reward"))))}};m.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const y=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.isClickable=()=>!0,this.isShopNow=a=>!!(salla.config.get("store.features")||[]).includes("loyalty-system-v2")&&"free_product"===a.key?.toLowerCase(),this.handleClick=a=>{salla.config.isGuest()?t((()=>salla.event.dispatch("login::open"))):this.actionClick.emit(a)}}render(){return this.isClickable(this.prize)?r("div",{class:"s-loyalty-program-rewards-modal-action"},this.isShopNow(this.prize)?r("salla-button",{fill:"outline",color:"light",class:"s-loyalty-program-rewards-action-base",onClick:()=>t()},salla.lang.get("common.elements.cancel")):r("button",{onClick:this.handleClick,class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":!0}},salla.lang.get("pages.loyalty_program.redeem_reward"))):null}};y.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const g=class{constructor(r){a(this,r),this.areaClick=e(this,"areaClick"),this.actionClick=e(this,"actionClick")}render(){return r(s,{key:"b63690e8c960ef4c33cd2510775e80fa06a39b82",class:"s-loyalty-program-reward-host"},r("div",{key:"1b5b2a02f13b30e70c38323328cf8862f0f4ba8f",class:"s-loyalty-program-reward-container"},r("div",{key:"0a35ac9e2d87f2d6c228fbb547e1842bd2243512",onClick:a=>this.areaClick.emit(a),role:"button"},r("div",{key:"aa2e1b5ce4e4fd186df5ad3fc25dc3fa3ccbb0fd",class:"s-loyalty-program-reward-img"},r("img",{key:"ecff4f5c86db5742910eaf402768422b93c001c3",alt:"",src:this.prize.image||salla.url.cdn("images/s-empty.png"),class:"s-loyalty-program-rewards-img"})),r("div",{key:"39216ef7e75a83770ba883e03aa26b39912292f6",class:"s-loyalty-program-reward-content"},r("div",{key:"047544aeaac2ac45e8782d11e6f08691f10864da",class:"s-loyalty-program-reward-points"},r("salla-badge",{key:"9564bdd0494ccb1812d30518384ede3b914edce4",size:"xs"},r("span",{key:"2a3ecf06e9475b0a2d6bff174b46ee15646312d5",innerHTML:d}),r("span",{key:"776d694e330d57366c084aa321845e964825cfe9",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),r("div",{key:"05e322f1a272ca223d431905c9566cc57af9e8b4",class:"s-loyalty-program-reward-title"},r("span",{key:"b3699e555190bb1c45c14a46c2c16a620ebcd9af"},this.prize.group_title)),r("div",{key:"fbdac88e90edf90ee1c6d7c66add35d28141ad36",class:"s-loyalty-program-reward-name"},r("div",{key:"5f2b92831df7628b390921098cd84849b9f13a4d",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name,this.prize.description?`: ${this.prize.description}`:"")))),r("div",{key:"f0f23a84cd12ba830212df2bee319f1e05bc5752",class:"p-4"},r("slot",{key:"33e3a2e4fe99e3db9300b69b14cba240e1c9b4de",name:"action"},r("button",{key:"70f128d1ebaba775b9cd5848f043abf9f5f8163f",onClick:a=>this.actionClick.emit(a.detail),class:"s-loyalty-program-rewards-action-base s-loyalty-program-rewards-action-on"},salla.lang.get("pages.loyalty_program.show_reward"))))))}};g.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";var h=function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);return l>3&&o&&Object.defineProperty(e,r,o),o};const f=(...a)=>a.map((a=>"s-loyalty-program-"+a)).join(" "),u=class{constructor(r){a(this,r),this.actionClick=e(this,"actionClick"),this.productActionClick=e(this,"productActionClick"),this.refreshKey=Date.now(),this.includedProductsData=[]}handleProductExchange(a){this.productActionClick.emit({productId:a.detail.productId})}handlePrizeChange(){this.refreshKey=Date.now(),this.fetchIncludedProducts()}componentWillLoad(){"idle"===this.category.status&&this.category(),"idle"===this.brand.status&&this.brand(),this.fetchIncludedProducts()}async fetchIncludedProducts(){this.includedProductsData=[];const a=this.prize?.included_product_ids;if(!a?.length)return;const e=this.prize;try{const r=await salla.api.withoutNotifier((()=>salla.product.api.fetch({source:"selected",source_value:a})));this.prize===e&&(this.includedProductsData=r.data||[])}catch{this.includedProductsData=[]}}getTermsAndConditions(){const a=Number((this.prize.order_minimum_amount||"0").split(".")[0])||0,e=Number((this.prize.coupon_maximum_amount||"0").split(".")[0])||0,r=[];return a&&r.push([salla.lang.get("pages.loyalty_program.order_minimum_amount"),`${a} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),e&&r.push([salla.lang.get("pages.loyalty_program.coupon_maximum_amount"),`${e} ${salla.lang.get(`currency.${(salla.config.get("user.currency_code")||"").toLowerCase()}`)}`]),r}findItems(a){return a?.length?this.brand.data.concat(this.category.data).filter((e=>a.includes(e.id_))):[]}getIncludedItems(a,e){return a?.length?a:e?.length?this.findItems(e):[]}getProductIds(a){return a||[]}getItemsMarkers(a){return"both"===a?this.getItemsMarkers("included")+this.getItemsMarkers("excluded"):[this.prize[`${a}_product_ids`]?.length||0,this.prize[`${a}_brand_ids`]?.length||0,this.prize[`${a}_category_ids`]?.length||0].map(Boolean).map(Number).join("")}getItemsMarkersText(){if("FREE_SHIPPING"===this.prize.key)return salla.lang.get("pages.loyalty_program.redeem_for_free_shipping");switch(this.getItemsMarkers("included")){case"001":default:return salla.lang.get("pages.loyalty_program.redeem_on_specific_products");case"010":return salla.lang.get("pages.loyalty_program.redeem_on_specific_brands");case"100":return salla.lang.get("pages.loyalty_program.redeem_on_specific_categories");case"000":return salla.lang.get("pages.loyalty_program.redeem_on_all_products")}}getCategoriesJsx(a,e){return a.length?r("div",{class:f("reward-details-categories-wrapper")},r("div",{class:f("reward-details-categories")},r("h2",{class:f("reward-details-categories-heading")},e),r("ul",{class:f("reward-details-categories-list")},a.map((a=>r("li",null,r("a",{href:a.urls?.customer||a.url||a.lingual_urls?.[0],class:f("reward-details-categories-item")},r("span",{innerHTML:i}),r("span",{class:f("reward-details-categories-item-content")},a.name)))))))):""}getBrandsJsx(a,e){return a.length?r("div",{class:f("reward-details-items-brands","slider-arrows-edges")},r("div",null,r("h2",null,e),r("salla-slider",{id:`brands-${a.map((({id:a})=>a)).join("-")}`,"slider-config":'{"loop":false,"slidesPerView":"auto","spaceBetween":10}'},r("div",{slot:"items"},a.map((a=>r("a",{href:salla.url.get(l(a)),class:f("reward-brand-item")},r("img",{src:a.logo||salla.url.cdn("images/s-empty.png"),alt:""})))))))):""}getProductsJsx(a,e){return a?.length?r("div",{class:"s-loyalty-program-reward-details-items-products s-loyalty-program-slider-arrows-edges"},r("h2",null,e),r("salla-products-slider",{source:"selected",sourceValue:JSON.stringify(a),"slider-config":'{"loop":false,"slidesPerView":"auto","freeMode":true,"spaceBetween":0,"breakpoints":{"768":{"slidesPerView":3,"freeMode":false,"speed":300}}}'})):""}getIncludedProductsJsx(a){const e=this.includedProductsData;return e?.length?r("div",{class:f("reward-details-items-products")},r("h2",null,a),r("div",{class:f("reward-details-products-grid")},e.map((a=>r("salla-loyalty-exchange-product-card",{product:a}))))):""}render(){const a=this.getTermsAndConditions();return r("div",{key:"08f402196aa5268a8bbf1dba1e037c45c33ae8a5",class:"s-loyalty-program-reward-modal"},r("div",{key:"75ae87a6055125371003a6bfd4e3f94c4a462c08",class:"s-loyalty-program-points-modal-header"},r("h1",{key:"4296046ef1409ec92c95e37fbea65506fb37929c",class:"s-loyalty-program-points-modal-info"},salla.url.is_page("cart")?r("button",{class:"s-loyalty-program-back-btn",onClick:()=>t((()=>salla.event.dispatch("modal::open","loyalty-rewards-modal")))},r("span",{class:{"sicon-arrow-right":"rtl"===document.documentElement.getAttribute("dir"),"sicon-arrow-left":"ltr"===document.documentElement.getAttribute("dir")}})):"",this.prize.name)),r("div",{key:"b6fd9d5a010059e928321acf5b6e904044b20513",class:"s-loyalty-program-modal-scrollable-content"},r("div",{key:"ed9572e46bb3d0ebd71a7b8eeb363433024cefbd",class:"s-loyalty-program-reward-details-header"},r("div",{key:"016fa0be4fd911293dc5a9f9f239398eae863c3f",class:"s-loyalty-program-aspect-container"},r("img",{key:"365a070a815b146dd92e2f6ca163d240c48ea862",src:this.prize.image,alt:this.prize.name})),r("salla-badge",{key:"510102d16996e3e0da9daaf6da2ab219c05e3978",size:"sm",bg:"light"},r("span",{key:"2179f7c46fadf1b5f0c030439347714a689781a4",innerHTML:d}),r("span",{key:"99a756bc4f7c6e03207a1c0d3364814c036e284b",class:"s-loyalty-program-points-badge-points"},o(this.prize.cost_points)))),a.length?r("div",{class:"s-loyalty-program-terms-and-conditions"},r("h1",{class:"s-loyalty-program-terms-and-conditions-heading"},salla.lang.get("pages.loyalty_program.terms_and_conditions")),r("ul",{class:"s-loyalty-program-terms-and-conditions-list"},a.map((([a,e])=>r("li",{class:"s-loyalty-program-terms-and-conditions-item"},r("span",{class:"s-loyalty-program-terms-and-conditions-content"},a),r("span",{class:"s-loyalty-program-terms-and-conditions-content"},e)))))):"",r("div",{key:"a4e7a863b7b7f9fad0c98a0ed0882bd5db4081c3",class:"s-loyalty-program-reward-info-message"},r("h1",{key:"ef8b9e64808bdf59f8bedf74f912ef07a92c3318",class:"s-loyalty-program-reward-info-message-heading"},salla.lang.get("pages.loyalty_program.how_to_benefit_from_this_reward")),r("p",{key:"8777469b48d9c65b33d73d3dc510397f7255641e",class:"s-loyalty-program-reward-info-message-content"},this.getItemsMarkersText())),"FREE_SHIPPING"===this.prize.key||"000000"===this.getItemsMarkers("both")?"":r("div",{class:"s-loyalty-program-reward-details"},r("salla-tabs",{key:this.refreshKey},"000"===this.getItemsMarkers("included")?"":[r("salla-tab-header",{slot:"header",name:"included",style:{display:"000"===this.getItemsMarkers("excluded")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:c}),r("span",null,salla.lang.get("pages.loyalty_program.included"))),r("salla-tab-content",{slot:"content",name:"included"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.categories,this.prize.included_category_ids),salla.lang.get("pages.loyalty_program.included_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.brands,this.prize.included_brand_ids),salla.lang.get("pages.loyalty_program.included_brands")),this.getIncludedProductsJsx(salla.lang.get("pages.loyalty_program.included_products"))))],"000"===this.getItemsMarkers("excluded")?"":[r("salla-tab-header",{slot:"header",name:"excluded",style:{display:"000"===this.getItemsMarkers("included")?"none":"block"}},r("span",{class:"s-loyalty-program-reward-details-tab-icon",innerHTML:n}),r("span",null,salla.lang.get("pages.loyalty_program.excluded"))),r("salla-tab-content",{slot:"content",name:"excluded"},r("div",{class:"s-loyalty-program-reward-details-items-wrapper"},this.getCategoriesJsx(this.getIncludedItems(this.prize.excludedCategories,this.prize.excluded_category_ids),salla.lang.get("pages.loyalty_program.excluded_categories")),this.getBrandsJsx(this.getIncludedItems(this.prize.excludedBrands,this.prize.excluded_brand_ids),salla.lang.get("pages.loyalty_program.excluded_brands")),this.getProductsJsx(this.getProductIds(this.prize.excluded_product_ids),salla.lang.get("pages.loyalty_program.excluded_products"))))]))),r("salla-reward-action",{key:"aaad339124dd3e8fcac568540d627d6105712d2f",onActionClick:a=>this.actionClick.emit(a.detail),prize:this.prize}))}static get watchers(){return{prize:["handlePrizeChange"]}}};h([p((async()=>(await salla.product.api.categories()).data),{initialData:[]})],u.prototype,"category",void 0),h([p((async()=>(await salla.api.request("/brands")).data),{initialData:[]})],u.prototype,"brand",void 0),u.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";const b=class{constructor(e){a(this,e),this.productId=null}reset(a=0){setTimeout((()=>{t()}),a)}getApiErrorMessage(a){return a?.response?.data?.error?.message||a?.response?.data?.message||("string"==typeof a?a:null)||salla.lang.get("common.errors.error_occurred")}async handleConfirm(){try{await this.exchange(this.prize.id,null,this.productId),this.reset(300)}catch(a){salla.notify.error(this.getApiErrorMessage(a))}}handleCancel(){this.reset(0)}render(){return r(s,{key:"98f0ce7506f94fc6c9c5dd881791d7298daa0e0b"},r("div",{key:"72661d140a8dd7b6fe8b68a120ba00f951aeb6e4",class:"s-loyalty-program-exchange-heading"},r("div",{key:"dfad67d7df6e3fde30c463791eb45ae5b356fc96",class:"s-loyalty-program-circle-base s-loyalty-program-circle-size-xl s-loyalty-program-circle-variant-fill"},r("span",{key:"04d0832e50209a87605cf016d0a462640d6379ed",innerHTML:d})),r("h2",{key:"bf7282fbb2cfb9675c0c219d65c090a95e0177f3"},salla.lang.get("pages.loyalty_program.redeem_reward")),r("p",{key:"551233696f0b1a5b8d233bcbd618e8c6f65e9bf6"},salla.lang.get("pages.loyalty_program.redeem_confirmation")," ",r("span",{key:"780e095949141888f02d165c44a648d6569ee56a"},"(",this.prize.cost_points," ",salla.lang.get("pages.loyalty_program.point"),")")," ",salla.lang.get("pages.loyalty_program.for")," ",r("span",{key:"fac6c243a373833091bbd276d7f416c04f89abb7"},"(",this.prize.name,")"))),r("div",{key:"f806352839b2914570ee4331d3412224533cc1ca",class:"s-loyalty-program-exchange-btns"},r("salla-button",{key:"12a4c1d19a6f1ad7ac5acf09a4861b708f25fa42",width:"wide",loading:"pending"===this.exchange.status,onClick:()=>this.handleConfirm()},salla.lang.get("common.elements.confirm")),r("salla-button",{key:"5caa8e6cec4b4fc8f4968742d7de26282cb26c35",width:"wide",fill:"outline",color:"danger",onClick:()=>this.handleCancel()},salla.lang.get("common.elements.cancel"))))}};(function(a,e,r,s){var t,l=arguments.length,o=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(a,e,r,s);else for(var d=a.length-1;d>=0;d--)(t=a[d])&&(o=(l<3?t(o):l>3?t(e,r,o):t(e,r))||o);l>3&&o&&Object.defineProperty(e,r,o)})([p((async(...a)=>await salla.loyalty.exchange(...a)))],b.prototype,"exchange",void 0),b.style="@media (max-width: 639px){.s-loyalty-program-modal .s-modal-body{position:relative !important;left:unset !important;bottom:unset !important;max-height:100dvh;overflow-y:auto !important}}.s-loyalty-exchange-card salla-product-card .s-product-card-image,.s-loyalty-exchange-card custom-salla-product-card .s-product-card-image{flex:none;aspect-ratio:1;overflow:hidden}.s-loyalty-exchange-card-btn{padding:0 1.25rem 1.25rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid{display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.75rem}.s-loyalty-program-reward-details-products-grid>*{flex:1 1 100%;min-width:0;touch-action:pan-y}@media (min-width: 640px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 1rem) / 2)}}@media (min-width: 768px){.s-loyalty-program-reward-details-products-grid>*{flex-basis:calc((100% - 2rem) / 3)}}.s-loyalty-program-reward-details-products-grid>*:only-child{max-width:320px;margin-inline:auto}.s-loyalty-program-reward-details-products-grid:has(>*:nth-child(3))>*{flex-grow:0}";export{m as salla_loyalty_exchange_product_card,y as salla_reward_action,g as salla_reward_card,u as salla_reward_details,b as salla_reward_exchange}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as i,H as e,a as t}from"./p-DuoSRdS5.js";function l(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==i?console.log(s,i):console.log(s))}async function r(s,i){l("fetchCities start",{productId:s,keyword:i});const e=null!=i?`?keyword=${encodeURIComponent(i)}`:"",t=await salla.api.request(salla.url.api(`products/${s}/delivery-promises/cities${e}`));return t.success&&Array.isArray(t.data)&&0!==t.data.length?(l("fetchCities success",{count:t.data.length}),{cities:t.data}):(l("fetchCities: no data",{response:t}),{cities:[]})}function a(){const s=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return s&&"object"==typeof s?s:null}const o={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",h=class{constructor(i){s(this,i),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=o,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=s=>{if(clearTimeout(this.citySearchTimer),!s.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(s)),300)},this.handleHeaderClick=s=>{s.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",o.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",o.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",o.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",o.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",o.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",o.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",o.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",o.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",o.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",o.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2")&&Salla.config.get("store.settings.bullet_delivery.enabled"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const s="store.shipping.delivery_location",i={cityId:salla.config.get(`${s}.city_id`),cityName:salla.config.get(`${s}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):i}async initLoginCycleFlow(){const s=this.applyBulletIntent(),{cityId:i,cityName:e}=this.getIPDeliveryLocation();l("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),i&&e&&!s&&(this.selectedLabel=`${this.labels.deliveryTo} ${e}`,await this.loadDeliveryMessage(i,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const s=function(){const s=a();if(!s)return null;if("address"===s.type){const i=s.address_details?.city,e=null!=i?.id?Number(i.id):null!=s.city_id?Number(s.city_id):null,t=i?.name?.trim()||"";return null!=e?{type:"address",option:{id:e,name:t}}:null}if("branch"===s.type){const i=null!=s.branch_id?Number(s.branch_id):null!=s.branch_details?.id?Number(s.branch_details.id):null,e=s.branch_details?.name?.trim()||"";return null!=i?{type:"branch",option:{id:i,name:e}}:null}return null}();return s?("address"===s.type?(this.selectedCityLoginCycle=s.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${s.option.name||this.labels.selectCity}`,this.loadDeliveryMessage(s.option.id,"city")):(this.selectedBranchLoginCycle=s.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${s.option.name}`,this.loadDeliveryMessage(s.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const s=a(),i={};if("address"===s?.type&&null!=s.address_id&&(i.preselected_address_id=Number(s.address_id)),"branch"===s?.type){const e=s.branch_id??s.branch_details?.id;null!=e&&(i.preselected_branch_id=Number(e))}return i}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:s,cityName:i}=this.getIPDeliveryLocation();l("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:e}=await r(this.productId);if(!e.length)return void(this.canRender=!1);if(this.cities=e,this.canRender=!0,s&&i){this.selectedLabel=`${this.labels.deliveryTo} ${i}`;const e=this.cities.find((i=>String(i.id)===String(s)));e&&(l("delivery promise standard flow autoCity found",e),this.selectedCity=e),await this.loadDeliveryMessage(s,"city")}}catch(s){this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(s,i){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(s,i,e,t){l("fetchDeliveryMessage start",{productId:s,id:i,optionType:e});let r="";r="city"!==e||t?`?reference_id=${i}&reference_type=${e}`:`?reference_id=${i}`;const a=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${s}/delivery-promises${r}`))));if(!a.success)throw l("fetchDeliveryMessage error",{response:a}),new Error(a.error?.message||"Failed to fetch delivery promise");const o=a.data?.message?.trim();return l("fetchDeliveryMessage success",{message:o}),o||null}(this.productId,s,i,this.isLoginCycleEnabled)}catch(s){this.hasError=!0,this.errorMessage="city"===i?this.labels.errorDeliveryPromise:this.labels.errorPickupPromise}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(s){const i=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:e}=await r(this.productId,s);if(i!==this.citySearchCounter)return;this.modalCities=e}catch{if(i!==this.citySearchCounter)return;this.modalCities=[]}finally{i===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const s=this.cityPendingSelection;this.selectedCity=s,this.selectedLabel=`${this.labels.deliveryTo} ${function(s){const i=salla.config.get("user.language_code");return i&&"ar"!==i&&s.name_en?.trim()?s.name_en.trim():s.name}(s)}`,await this.loadDeliveryMessage(s.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return i("div",{class:"s-delivery-promise-modal-body"},i("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:s=>{this.cityPendingSelection=s.detail},onSearchInput:s=>{this.handleCitySearch(s.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:i("salla-modal",{id:"s-delivery-promise-city-modal",ref:s=>{this.cityModalRef=s},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),i("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.selectedLabel)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return t(this)}};export{h as salla_delivery_promise}
|
|
4
|
+
import{r as s,h as i,H as e,a as t}from"./p-BOjfFBGe.js";function l(s,i){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==i?console.log(s,i):console.log(s))}async function r(s,i){l("fetchCities start",{productId:s,keyword:i});const e=null!=i?`?keyword=${encodeURIComponent(i)}`:"",t=await salla.api.request(salla.url.api(`products/${s}/delivery-promises/cities${e}`));return t.success&&Array.isArray(t.data)&&0!==t.data.length?(l("fetchCities success",{count:t.data.length}),{cities:t.data}):(l("fetchCities: no data",{response:t}),{cities:[]})}function a(){const s=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return s&&"object"==typeof s?s:null}const o={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",h=class{constructor(i){s(this,i),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=o,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=s=>{if(clearTimeout(this.citySearchTimer),!s.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(s)),300)},this.handleHeaderClick=s=>{s.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",o.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",o.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",o.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",o.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",o.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",o.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",o.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",o.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",o.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",o.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2")&&Salla.config.get("store.settings.bullet_delivery.enabled"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const s="store.shipping.delivery_location",i={cityId:salla.config.get(`${s}.city_id`),cityName:salla.config.get(`${s}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):i}async initLoginCycleFlow(){const s=this.applyBulletIntent(),{cityId:i,cityName:e}=this.getIPDeliveryLocation();l("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),i&&e&&!s&&(this.selectedLabel=`${this.labels.deliveryTo} ${e}`,await this.loadDeliveryMessage(i,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const s=function(){const s=a();if(!s)return null;if("address"===s.type){const i=s.address_details?.city,e=null!=i?.id?Number(i.id):null!=s.city_id?Number(s.city_id):null,t=i?.name?.trim()||"";return null!=e?{type:"address",option:{id:e,name:t}}:null}if("branch"===s.type){const i=null!=s.branch_id?Number(s.branch_id):null!=s.branch_details?.id?Number(s.branch_details.id):null,e=s.branch_details?.name?.trim()||"";return null!=i?{type:"branch",option:{id:i,name:e}}:null}return null}();return s?("address"===s.type?(this.selectedCityLoginCycle=s.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${s.option.name||this.labels.selectCity}`,this.loadDeliveryMessage(s.option.id,"city")):(this.selectedBranchLoginCycle=s.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${s.option.name}`,this.loadDeliveryMessage(s.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const s=a(),i={};if("address"===s?.type&&null!=s.address_id&&(i.preselected_address_id=Number(s.address_id)),"branch"===s?.type){const e=s.branch_id??s.branch_details?.id;null!=e&&(i.preselected_branch_id=Number(e))}return i}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:s,cityName:i}=this.getIPDeliveryLocation();l("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:e}=await r(this.productId);if(!e.length)return void(this.canRender=!1);if(this.cities=e,this.canRender=!0,s&&i){this.selectedLabel=`${this.labels.deliveryTo} ${i}`;const e=this.cities.find((i=>String(i.id)===String(s)));e&&(l("delivery promise standard flow autoCity found",e),this.selectedCity=e),await this.loadDeliveryMessage(s,"city")}}catch(s){this.hasError=!0,this.errorMessage=s.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(s,i){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(s,i,e,t){l("fetchDeliveryMessage start",{productId:s,id:i,optionType:e});let r="";r="city"!==e||t?`?reference_id=${i}&reference_type=${e}`:`?reference_id=${i}`;const a=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${s}/delivery-promises${r}`))));if(!a.success)throw l("fetchDeliveryMessage error",{response:a}),new Error(a.error?.message||"Failed to fetch delivery promise");const o=a.data?.message?.trim();return l("fetchDeliveryMessage success",{message:o}),o||null}(this.productId,s,i,this.isLoginCycleEnabled)}catch(s){this.hasError=!0,this.errorMessage="city"===i?this.labels.errorDeliveryPromise:this.labels.errorPickupPromise}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(s){const i=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:e}=await r(this.productId,s);if(i!==this.citySearchCounter)return;this.modalCities=e}catch{if(i!==this.citySearchCounter)return;this.modalCities=[]}finally{i===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const s=this.cityPendingSelection;this.selectedCity=s,this.selectedLabel=`${this.labels.deliveryTo} ${function(s){const i=salla.config.get("user.language_code");return i&&"ar"!==i&&s.name_en?.trim()?s.name_en.trim():s.name}(s)}`,await this.loadDeliveryMessage(s.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return i(e,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},i("div",{class:"s-delivery-promise-location"},i("salla-skeleton",{height:"14px",width:"180px"})),i("salla-skeleton",{height:"18px",width:"18px"})),i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?i("div",{class:"s-delivery-promise-loading"},i("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?i("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return i("div",{class:"s-delivery-promise-modal-body"},i("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:s=>{this.cityPendingSelection=s.detail},onSearchInput:s=>{this.handleCitySearch(s.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:i("salla-modal",{id:"s-delivery-promise-city-modal",ref:s=>{this.cityModalRef=s},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),i("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?i(e,{class:"s-delivery-promise-wrapper"},i("div",{class:"s-delivery-promise-container"},i("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},i("div",{class:"s-delivery-promise-location"},i("span",{class:"s-delivery-promise-title"},this.selectedLabel)),i("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&i("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return t(this)}};export{h as salla_delivery_promise}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as o}from"./p-
|
|
4
|
+
import{r as s,h as t,H as o}from"./p-BOjfFBGe.js";const e=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},salla.lang.get("common.elements.attachments")):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:'\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>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},salla.lang.get("common.elements.show_location")))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};e.style="";export{e as salla_order_details_options}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,c as a,h as t,H as s}from"./p-
|
|
4
|
+
import{r as e,c as a,h as t,H as s}from"./p-BOjfFBGe.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"1a3463c51bf3e3e250f62b65d3a81815ec465923"},t("div",{key:"03bf4d3e35b10d17a325ca4ef280cb384f3a76f4",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"a4d319b2daec5cdfec1c85910edea10bc1d1ab6c",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"52059fafc318c1f5a6b0289669083476650f8761",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"a3e14e2d1bd86dc3e7dbd2e6c5115e119af965e5",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"55df95c028748c0387dc75dc4ad35c7285c907af",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,F as t,H as a}from"./p-
|
|
4
|
+
import{r as s,h as e,F as t,H as a}from"./p-BOjfFBGe.js";const r=class{constructor(e){s(this,e)}parseOrderDetailsData(s){this.parsedOrderDetailsData=s,this.parsedOrderDetailsData="string"==typeof this.orderDetails?JSON.parse(s):s}componentWillLoad(){this.parseOrderDetailsData(this.orderDetails),console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)}renderOrderDetailsContent(){return this.parsedOrderDetailsData?[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&e("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&e(t,null,e("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),e("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((s=>e("salla-order-details-multiple-bundle-product",{key:s?.id,productDetails:s})))))]:(console.warn("No parsedOrderDetailsData available"),null)}render(){return e(a,{key:"ffa22cae6c347b5acbe4836378f1f3843184e8f5",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())}static get watchers(){return{orderDetails:["parseOrderDetailsData"]}}};r.style="";export{r as salla_order_details}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as s,h as i,H as e,a as n}from"./p-DuoSRdS5.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
|
|
4
|
+
import{r as t,c as s,h as i,H as e,a as n}from"./p-BOjfFBGe.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"610ae038d4f9db109e3f25830e82b39a2b07a010"},i("salla-modal",{key:"b06c130448cd1862d2e879a0285fd385395cc11b",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"1f8b9ffa80a40f8240ede4b8996943f7eecf4098",slot:"loading"},i("salla-skeleton",{key:"26463b16022e1f66fd66f4e9cd8907521352bac1",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"bae60782cbe4ac7dc325fd666258198cd871a52e",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"998afc3297e89df7e0a6b2514a6d5f4f75152492",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"935a3d01a417926e904507d0a64da43c84924068",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"eeb710a27917f6134a2595ebb8e4ec485bb26254",slot:"footer"},i("div",{key:"2ae3d47c461b68d61fcaa1d8f279ae6402aedf2e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"436f64a89183f0e6d56b6800ad031449c49cc751",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"e473b6089ee0e7026dfec042462ed827dabd0083"},i("salla-slider",{key:"492187e1a1c105c21c48543aa227888d122cfa20",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"e40e816439f3b3e1bee12ebdcea60438a45fec12",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,c as t,h as i,H as e,a as h}from"./p-
|
|
4
|
+
import{r as s,c as t,h as i,H as e,a as h}from"./p-BOjfFBGe.js";import{e as r}from"./p-DzAIgzdz.js";const l=class{constructor(i){s(this,i),this.verified=t(this,"verified"),this.translationLoaded=!1,this.display="modal",this.type="mobile",this.autoReload=!0,this.supportWebAuth=!0,this.resendAfter=30,this.isProfileVerify=!1,salla.lang.onLoaded((()=>{this.translationLoaded=!0,this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+this.type),this.modal?.setTitle(this.title)})),"inline"!=this.display?(salla.event.on("profile::verification",(s=>{let t=Array.isArray(s)?s[0]:s;this.isProfileVerify=!0,this.open(t),this.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+t.type),this.modal?.setTitle(this.title)})),salla.event.on("modalClosed",(()=>{this.resendAfter=0,this.timer.innerHTML="30 : 00"}))):this.modal={open:()=>"",close:()=>"",setTitle:()=>""}}splitNumber(s){this.resetError();let t=s.data||s.target.value;t&&1!==t.length&&this.modifyNext(s.target,t)}modifyNext(s,t){s.value=t[0],t=t.substring(1),s.nextElementSibling&&t.length?this.modifyNext(s.nextElementSibling,t):s.nextElementSibling||0!==t.length?s.nextElementSibling&&0===t.length&&s.nextElementSibling.focus():s.focus()}checkAllInputs(){let s=!0;for(let t=0;t<this.otpInputs.length;t++)""===this.otpInputs[t].value&&(s=!1);return s}handleKeyUp(s){if(this.resetError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(s.key))return;let t=s.keyCode||s.charCode;s.target.value?(s.target.nextElementSibling?.focus(),s.target.nextElementSibling?.select()):[8,46].includes(t)&&(s.target.previousElementSibling?.focus(),s.target.previousElementSibling?.select()),s.target.value.length>1&&this.splitNumber(s)}handlePaste(s){this.resetError();let t=(salla.helpers.number(s.clipboardData.getData("text"))||"").replace(/[^0-9]/g,"");t=t.substring(0,this.otpInputs.length),this.otpInputs.forEach((s=>s.value="")),this.modifyNext(this.otpInputs[0],t)}handleInput(s){this.resetError(),salla.helpers.inputDigitsOnly(s.target),this.checkAllInputs()&&setTimeout((()=>{this.toggleOTPSubmit()}),100)}resetError(){this.hasError=!1,this.errorMessage=""}handleFocus(s){s.target!==this.firstOtpInput&&(""==this.firstOtpInput?.value&&this.firstOtpInput.focus(),""==s.target.previousElementSibling.value&&s.target.previousElementSibling.focus())}async getCode(){return this.code.value}async open(s){this.data=s,this.data.type=this.data.type||this.type,this.type=this.data.type,this.resendTimer(),this.otpInputs=this.body.querySelectorAll(".s-verify-input"),this.firstOtpInput=this.body.querySelector("#otp-1"),this.reset(),this.resetError(),"modal"==this.display&&this.modal?.setTitle(this.title),this.modal.open(),this.firstOtpInput?.addEventListener("input",(s=>this.splitNumber(s))),setTimeout((()=>this.otpInputs[0].focus()),100)}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.disable(),void this.btn.click();this.btn.enable()}reset(){this.otpInputs.forEach((s=>s.value="")),this.code.value="",this.otpInputs[0].focus()}resendTimer(){this.resendMessage.style.display="block",this.resend.style.display="none",this.resendAfter=30;let s=setInterval((()=>{this.resendAfter<=0?(clearInterval(s),this.resend.style.display="block",this.resendMessage.style.display="none"):(this.timer.innerHTML=`${this.resendAfter>=10?this.resendAfter:"0"+this.resendAfter} : 00`,this.resendAfter--)}),1e3)}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend(this.data))).finally((()=>this.resendTimer()))}submit(){if(this.code.value.length<4)return this.otpInputs[this.code.value.length].focus(),void salla.log("Trying to submit without 4 digits!");let s={code:this.code.value,...this.data};return this.btn.load().then((()=>this.btn.disable())).then((()=>this.isProfileVerify?salla.profile.verify(s):salla.auth.verify(s,this.supportWebAuth))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.close())).then((()=>this.autoReload&&window.location.reload())).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"),s.response?salla.logger.error(s):console.log("Unexpected error",s),this.btn.stop()&&this.btn.enable()&&this.reset()}))}render(){return"inline"==this.display?i(e,null,this.myBody()):i("salla-modal",{width:"xs",class:"s-verify",ref:s=>this.modal=s,"modal-title":this.title},i("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:"mobile"==this.type?'\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>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n':r}),this.myBody())}myBody(){return i("div",{class:"s-verify-body",ref:s=>this.body=s},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("slot",{name:"mobile"}),i("slot",{name:"email"}),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:{"s-verify-codes":!0,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((s=>i("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:`otp-${s}`,class:{"s-verify-input":!0,"s-has-error":this.hasError},onInput:s=>this.handleInput(s),onPaste:s=>this.handlePaste(s),onKeyUp:s=>this.handleKeyUp(s),onFocus:s=>this.handleFocus(s),required:!0})))),this.hasError&&this.errorMessage?i("span",{class:"s-verify-error-message"},this.errorMessage):"",i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))),i("slot",{name:"after-footer"}))}get host(){return h(this)}};l.style="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";export{l as salla_verify}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,H as t}from"./p-
|
|
4
|
+
import{r as s,h as e,H as t}from"./p-BOjfFBGe.js";const a=class{constructor(e){s(this,e),this.type="normal",this.width="100%",this.height="100%"}render(){return e(t,{key:"7b36da96585cfefe9aa96df6262be14f6a03c585",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},e("div",{key:"568ae1bc0aeae182bb32468b19601c0245e9617d",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};a.style=":host{display:block}";export{a as salla_skeleton}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as r,H as a}from"./p-
|
|
4
|
+
import{r as t,h as r,H as a}from"./p-BOjfFBGe.js";import{S as s}from"./p-D4oPi1Ov.js";const e=new Map,i=new Map;function o(t){return t?Array.isArray(t)?t:Object.values(t):[]}const c=class{constructor(r){t(this,r),this.factors=[]}async componentWillLoad(){await salla.onReady(),await this.loadFactors()}async loadFactors(){if(this.orderId)try{const t=await async function(t){if(!t)return null;const r=e.get(t);if(r&&Date.now()-r.timestamp<=3e5)return r.data;const a=i.get(t);if(a)return a;const s=(async()=>{try{const r=await salla.api.request(`orders/${t}`,"","get"),a=r?.data??r;return e.set(t,{data:a,timestamp:Date.now()}),a}catch(r){throw e.delete(t),r}finally{i.delete(t)}})();return i.set(t,s),s}(this.orderId);this.factors=function(t,r,a,s){var e;const i=function(t,r,a,s){return t.find((t=>!(!r||Number(t.id??t.feedback_id)!==Number(r))||!(!s||Number(t.order_item_id)!==Number(s))||!(!a||Number(t.product_id??t.product?.id)!==Number(a))))}((e=t?.rating,e?[...o(e.product),...o(e.products)]:[]),r,a,s);return function(t){if(!t)return[];for(const r of["factor_reviews","review_factors","factors"]){const a=t[r];if(Array.isArray(a)&&a.length)return a}return[]}(i)}(t,this.ratingId,this.productId,this.itemId)}catch(t){console.error("[salla-review-factors-tags] failed to load order rating factors",t),this.factors=[]}else this.factors=[]}renderFactorTags(){const t=this.factors||[];return t.length?r("div",{class:"s-review-factors-tags-factors"},t.map((t=>r("div",{class:"s-review-factors-tags-factor-tag"},r("span",{class:"s-review-factors-tags-factor-name"},t.name),r("span",{class:"s-review-factors-tags-factor-star",innerHTML:s}),r("span",{class:"s-review-factors-tags-factor-rating"},t.rating||""))))):null}render(){return r(a,{key:"63e1ae3d8b45cdd9c82ade65cf6b33be9941f9d1",class:"s-review-factors-tags-wrapper"},this.renderFactorTags())}};c.style=":host{display:inline-flex}.s-review-factors-tags-factors{display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:flex-start;margin-bottom:0.6rem}.s-review-factors-tags-factor-tag{display:inline-flex;align-items:center;gap:0.25rem;border-radius:999px;border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);color:#374151;font-size:0.85rem;line-height:1;padding:0.4rem 0.65rem}.s-review-factors-tags-factor-rating{font-weight:600;color:#0f6a7c}.s-review-factors-tags-factor-star{display:inline-flex;width:0.8rem;height:0.8rem;fill:#0f6a7c}.s-review-factors-tags-factor-star svg{width:100%;height:100%}";export{c as salla_review_factors_tags}
|
|
@@ -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}from"./p-
|
|
4
|
+
import{r as s,h as t,H as e,a}from"./p-BOjfFBGe.js";const i=class{constructor(t){s(this,t),this.isVisible=!0,this.isMobile=!1,this.mobileBreakpoint=768,this.mobileQueryHandler=s=>this.isMobile=s.matches,this.openRequestedHandler=()=>this.open(),this.selectedConsent="rejected"}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.loadTranslations(),this.selectedConsent=this.getStoredConsentChoice(),Salla.event.on("salla-cookies-bar::open",this.openRequestedHandler),this.unregisterAfterFetchMenuItemsHook=Salla.hooks.registerHook("salla-menu","afterFetchMenuItems",(s=>this.appendCookiesSettingsLink(s))),Salla.storage.get("cookies-consent")&&(this.isVisible=!1)}loadTranslations(){this.messageLabel=Salla.lang.get("common.cookies.message"),this.linkLabel=Salla.lang.get("common.cookies.link"),this.acceptLabel=Salla.lang.get("common.cookies.accept"),this.rejectLabel=Salla.lang.get("common.cookies.reject")}componentDidLoad(){this.mobileQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.isMobile=this.mobileQuery.matches,this.mobileQuery.addEventListener("change",this.mobileQueryHandler)}disconnectedCallback(){this.mobileQuery?.removeEventListener("change",this.mobileQueryHandler),Salla.event.off("salla-cookies-bar::open",this.openRequestedHandler),this.unregisterAfterFetchMenuItemsHook?.(),this.unregisterAfterFetchMenuItemsHook=void 0}async accept(){return this.selectedConsent="accepted",this.isVisible=!1,Salla.event.emit("salla-cookies-bar::accepted"),Salla.storage.set("cookies-consent","accepted"),this.host}async reject(){return this.selectedConsent="rejected",this.isVisible=!1,Salla.event.emit("salla-cookies-bar::rejected"),Salla.storage.set("cookies-consent","rejected"),this.host}async open(){return this.selectedConsent=this.getStoredConsentChoice(),this.isVisible=!0,this.host}getStoredConsentChoice(){const s=Salla.storage.get("cookies-consent");return"accepted"===s||"rejected"===s?s:"rejected"}isRtl(){return Salla.config.get("theme.is_rtl",!0)}appendCookiesSettingsLink(s){const t=Salla.config.get("store.features")?.includes("website-cookies");if(!t||!s?.withCookiePreferences||"footer"!==s?.source)return;const e="#cookies-settings",a=s?.menus.some((s=>s?.url===e));a||(s.menus=[...s.menus,{id:"cookies-settings",order:null,title:Salla.lang.get("common.cookies.settings"),url:e,target:"_self",is_by_form_builder:!1,children:[],image:null,callback:()=>Salla.event.emit("salla-cookies-bar::open")}])}render(){return this.isVisible?t(e,null,t("div",{dir:this.isRtl()?"rtl":"ltr",class:"s-cookies-bar fixed bottom-0 inset-x-0 z-50 bg-white p-4"},t("div",{class:"s-cookies-bar-content flex flex-col justify-center gap-6 max-w-screen-xl mx-auto px-4"},t("p",{class:"s-cookies-bar-message text-sm font-medium leading-relaxed text-gray-500 m-0"},this.messageLabel,Salla.config.get("policy_url")&&t("a",{href:Salla.config.get("policy_url"),target:"_blank",class:"s-cookies-bar-link text-primary ms-1"},this.linkLabel)),t("div",{class:"s-cookies-bar-actions flex flex-row gap-2 shrink-0"},t("salla-button",{class:"s-cookies-bar-btn--accept "+("rejected"===this.selectedConsent?"s-cookies-bar-btn--active":""),color:"primary",fill:"rejected"===this.selectedConsent?"solid":"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.accept()},this.acceptLabel),t("salla-button",{class:"s-cookies-bar-btn--reject "+("accepted"===this.selectedConsent?"s-cookies-bar-btn--active":""),color:"accepted"===this.selectedConsent?"primary":void 0,fill:"accepted"===this.selectedConsent?"solid":"outline",type:"button",size:this.isMobile?"small":"medium",onClick:()=>this.reject()},this.rejectLabel))))):t(e,null)}get host(){return a(this)}};i.style=":host{display:block;overflow:visible}.s-cookies-bar{box-shadow:0 0 20px 4px rgba(0, 0, 0, 0.15)}.s-cookies-bar-btn--active{box-shadow:0 0 0 2px rgba(0, 0, 0, 0.08)}";export{i as salla_cookies_bar}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r,h as s,H as n,F as t}from"./p-
|
|
4
|
+
import{r,h as s,H as n,F as t}from"./p-BOjfFBGe.js";function a(r,s){if("string"!=typeof r)return r??s;const n=r.trim();if(!n)return s;try{return JSON.parse(n)}catch{return s}}function e(r){if(r)return"string"==typeof r?a(r,void 0):r}function c(r,s="ar"){const[n,t]=String(r).trim().split(":").map(Number);if(!Number.isFinite(n)||!Number.isFinite(t))return r;const a=new Date(2e3,0,1,n,t),e={hour:"numeric",minute:"2-digit",hour12:!0};try{return a.toLocaleTimeString(s,e)}catch{return a.toLocaleTimeString("ar",e)}}const o=class{constructor(s){r(this,s),this.stackCards=!1,this.isLoading=!1}componentWillLoad(){return this.getBranchData()}async getBranchData(){const r=salla.config.get("page.id");if(r){this.isLoading=!0;try{const s=await salla.order.api.getBranchDetails(r);this.branchData=this.parseBranchResponse(s)}catch(r){this.notifyApiError(r)}finally{this.isLoading=!1}}}parseBranchResponse(r){const s=r?.data?.data||r?.data||r;return s&&"object"==typeof s&&Object.prototype.hasOwnProperty.call(s,"branch")?s.branch?e(s.branch):void 0:e(s)}getApiErrorMessage(r){return r?.response?.data?.error?.message||r?.response?.data?.message}notifyApiError(r){const s=this.getApiErrorMessage(r);s&&salla.notify.error(s)}label(r,s){return salla.lang.getWithDefault(r,s)}get preparationText(){const r=this.branchData?.preparation_time_range;if(!r?.from||!r?.to)return"";const s=salla.helpers.number(r.from.value),n=salla.helpers.number(r.to.value),t=this.unitLabel(r.to.unit),a=s===n?s:`${s}-${n}`;return this.label("pages.orders.pickup_ready_after","جاهز للاستلام بعد :time").replace(":time",`${a} ${t}`)}unitLabel(r){const s=function(r){const s=String(r||"hour").toLowerCase();return s.startsWith("min")?"minute":s.startsWith("day")?"day":"hour"}(r);return"minute"===s?this.label("pages.checkout.minute","دقيقة"):"day"===s?this.label("pages.checkout.day","يوم"):this.label("pages.checkout.hour","ساعة")}get workingHoursItems(){const r=this.branchData;if(!r)return[];if(!0===r.always_open||1===r.always_open||"1"===r.always_open)return[this.label("pages.orders.branch_always_open","مفتوح على مدار الساعة")];const s=salla.lang.locale||"ar";return(r.working_hours||[]).filter((r=>r?.name&&r.times?.length)).map((r=>{const n=r.times[0];return`${r.name}: ${c(n.from,s)} - ${c(n.to,s)}`}))}get branchAddress(){return this.branchData?.address||""}get mapUrl(){const r=this.branchData?.location;if(null!=r?.lat&&null!=r?.lng)return`https://www.google.com/maps?q=${r.lat},${r.lng}`}get phone(){return function(r){const s=a(r,null),n=s&&"object"==typeof s?s.phone:"";return"string"==typeof n?n.trim():""}(this.branchData?.contacts)}renderDetailsColumn(){const r=this.phone;return r?s("div",{class:"s-order-branch-details"},s("div",{class:"s-order-branch-info-card"},s("span",{class:"s-order-branch-info-icon",innerHTML:'\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>phone-talking</title>\n<path d="M18.667 8c2.941 0 5.333 2.392 5.333 5.333 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-4.412-3.588-8-8-8-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM18.667 2.667c5.881 0 10.667 4.785 10.667 10.667 0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333c0-7.352-5.981-13.333-13.333-13.333-0.737 0-1.333 0.596-1.333 1.333s0.596 1.333 1.333 1.333zM26.939 17.831c-1.568-1.568-4.119-1.568-5.689 0l-2.567 2.568c-3.064-1.499-5.584-4.019-7.083-7.083l2.569-2.567c1.567-1.569 1.567-4.121-0.001-5.689l-3.88-3.881c-1.521-1.521-4.169-1.521-5.691 0l-1.847 1.847c-2.22 2.22-3.183 5.408-2.573 8.527 1.979 10.144 10.127 18.292 20.271 20.271 0.617 0.121 1.236 0.18 1.851 0.18 2.491 0 4.895-0.972 6.676-2.752l1.847-1.847c1.569-1.569 1.569-4.12 0-5.689zM28.936 25.517l-1.847 1.847c-1.591 1.591-3.876 2.281-6.131 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.597-0.397 0.959-0.397s0.701 0.14 0.959 0.397l3.883 3.883c0.528 0.528 0.528 1.389 0 1.917l-3.22 3.219c-0.383 0.384-0.496 0.959-0.288 1.457 1.815 4.34 5.344 7.868 9.684 9.684 0.5 0.205 1.075 0.095 1.457-0.288l3.219-3.219c0.528-0.531 1.389-0.529 1.917-0.001l3.883 3.883c0.529 0.529 0.529 1.389 0 1.919z"></path>\n</svg>\n'}),s("div",{class:"s-order-branch-info-text"},s("span",{class:"s-order-branch-info-label"},this.label("pages.orders.branch_contacts","ارقام التواصل")),s("span",{class:"s-order-branch-info-value",dir:"ltr"},r)))):null}renderWorkingHoursCard(){const r=this.workingHoursItems;return r.length?s("div",{class:"s-order-branch-info-card s-order-branch-hours-card"},s("span",{class:"s-order-branch-info-icon","aria-hidden":"true"},s("i",{class:"sicon-calendar-alt"})),s("div",{class:"s-order-branch-info-text"},s("span",{class:"s-order-branch-info-label"},this.label("pages.checkout.working_hours","ساعات العمل")),s("div",{class:"s-order-branch-hours-list"},r.map((r=>s("span",{class:"s-order-branch-hours-item"},r)))))):null}renderBranchIdentityCard(){const r=this.branchData,n=this.branchAddress,t=this.preparationText;return s("section",{class:"s-order-branch-card"},s("div",{class:"s-order-branch-location"},s("div",{class:"s-order-branch-identity"},s("span",{class:"s-order-branch-store-icon"},s("i",{class:"sicon-store","aria-hidden":"true"})),s("div",{class:"s-order-branch-text"},s("div",{class:"s-order-branch-name-row"},r?.name?s("span",{class:"s-order-branch-name"},r.name):null,t?s("span",{class:"s-order-branch-ready"},t):null),n?s("span",{class:"s-order-branch-address"},n):null)),this.mapUrl?s("div",{class:"s-order-branch-actions"},s("a",{href:this.mapUrl,target:"_blank",rel:"noopener noreferrer",class:"s-order-branch-map-link"},s("span",null,this.label("pages.orders.branch_map","موقع الفرع علي الخريطة")),s("span",{class:"s-order-branch-action-icon",innerHTML:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.95448 2.79419C9.7395 1.84477 11.132 1.37005 11.881 2.11902C12.6299 2.86799 12.1552 4.2605 11.2058 7.04551L10.5593 8.94203C9.83014 11.0809 9.46556 12.1503 8.8646 12.2388C8.70303 12.2626 8.53577 12.2483 8.37592 12.197C7.78135 12.0061 7.46705 10.8785 6.83846 8.62339C6.69903 8.12319 6.62932 7.87308 6.47057 7.68206C6.4245 7.62662 6.37338 7.5755 6.31794 7.52943C6.12692 7.37068 5.87681 7.30097 5.37661 7.16154C3.12148 6.53295 1.99391 6.21865 1.80302 5.62408C1.7517 5.46423 1.73738 5.29698 1.76117 5.1354C1.84968 4.53444 2.91911 4.16986 5.05797 3.44072L6.95448 2.79419Z" stroke="currentColor" stroke-width="1.5"/>\n</svg>\n'}))):null))}render(){return this.isLoading||!this.branchData?s(n,{class:"s-order-branch-wrapper"}):s(n,{class:"s-order-branch-wrapper"},this.stackCards?s(t,null,this.renderBranchIdentityCard(),this.renderDetailsColumn()):s("div",{class:"s-order-branch-container"},this.renderBranchIdentityCard(),this.renderDetailsColumn()),this.renderWorkingHoursCard())}};o.style=":host{display:block}.s-order-branch-ready{background-color:color-mix(in srgb, var(--color-primary) 30%, transparent)}";export{o as salla_order_branch}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t}from"./p-
|
|
4
|
+
import{r as e,h as t}from"./p-BOjfFBGe.js";const r=class{constructor(t){e(this,t),this.factors=[]}getReviewFactorLabel(e){if(e.label)return e.label;const t=(salla.lang.locale||"ar").startsWith("ar")?["ضعيف","مقبول","جيد","جيد جدا","ممتاز"]:["Poor","Average","Good","Very good","Excellent"],r=[salla.lang.getWithDefault("pages.rating.poor",t[0]),salla.lang.getWithDefault("pages.rating.average",t[1]),salla.lang.getWithDefault("pages.rating.good",t[2]),salla.lang.getWithDefault("pages.rating.very_good",t[3]),salla.lang.getWithDefault("pages.rating.excellent",t[4])],i=Number(e.rating||0);return r[Math.max(1,Math.min(5,Math.round(i)))-1]||""}render(){return this.factors?.length?t("div",{class:"s-comments-item-review-factors"},this.factors.map((e=>t("div",{class:"s-comments-item-review-factor-row"},t("div",{class:"s-comments-item-review-factor-value"},t("span",{class:"s-comments-item-review-factor-label text-left rtl:text-right"},this.getReviewFactorLabel(e)),t("salla-rating-stars",{size:"mini",class:"s-comments-item-review-factor-stars",value:e.rating})),t("span",{class:"s-comments-item-review-factor-name"},e.name))))):null}};r.style=":host{display:block}.s-comments-item-review-factors-toggle{display:inline-flex;align-items:center;gap:0.35rem;padding:0;border:0;background:transparent;color:#0f6a7c;font-size:0.9rem;font-weight:500;cursor:pointer}.s-comments-item-review-factors-chevron{line-height:1;transform:rotate(180deg);transition:transform 0.2s ease}.s-comments-item-review-factors-chevron.is-open{transform:rotate(0deg)}.s-comments-item-review-factors{border:1px solid #e8e8e8;background:rgba(255, 255, 255, 0.3);border-radius:0.6rem;width:min(100%, 26rem);max-width:100%;margin:0 0 1rem;padding:0.85rem 1rem}@media (max-width: 767px){.s-comments-item-review-factors{width:100%;padding:0.75rem}}.s-comments-item-review-factor-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;direction:ltr;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-row{flex-direction:row;align-items:stretch;gap:0.35rem}}.s-comments-item-review-factor-row+.s-comments-item-review-factor-row{margin-top:0.5rem}.s-comments-item-review-factor-label,.s-comments-item-review-factor-name{color:#4b5563;font-size:0.9rem;line-height:1.45}.s-comments-item-review-factor-name{min-width:6.5rem;text-align:end;flex-shrink:0}@media (max-width: 767px){.s-comments-item-review-factor-name{min-width:5rem;text-align:end}}.s-comments-item-review-factor-label{display:inline-block;min-width:4.75rem}@media (max-width: 767px){.s-comments-item-review-factor-label{min-width:0;flex:1 1 auto}}.s-comments-item-review-factor-value{display:inline-flex;align-items:center;gap:0.35rem;min-width:0}@media (max-width: 767px){.s-comments-item-review-factor-value{width:100%;justify-content:space-between;gap:0.25rem}}.s-comments-item-review-factor-stars{flex-shrink:0}.s-comments-item-review-factor-stars .s-rating-stars-wrapper{gap:0}";export{r as salla_comment_factors}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,c as t,h as i,H as e,a as r}from"./p-DuoSRdS5.js";import{S as a}from"./p-CciN5Q_x.js";import{e as l}from"./p-DzAIgzdz.js";import{S as h}from"./p-8Tsmrwno.js";const o=class{constructor(i){s(this,i),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(s,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${s}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(s){let t,i=s.target,e=i.validity;e.valueMissing?(t=this.getErrorMessage("field_required",i.name),console.log(this.getErrorMessage("field_required",i.name))):e.typeMismatch&&(t=this.getErrorMessage("invalid_value",i.name)),i.setCustomValidity(t)}async setWrapperHeight(){let s=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{s.style.maxHeight=s.style.maxHeight||this.oneClick?null:s.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(s,t=!1){return s.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((s=>salla.api.cart.createQuickOrder(s))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((s=>s&&(console.error(s),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(s,t=150){return s?s.length<=t?s:(new DOMParser).parseFromString(s,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let s=salla.config.get("store.settings.quick_order");return s?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(s),Promise.resolve()):Promise.resolve()}initComponentData(s){this.quickOrderTitle=s.title,this.subTitle=s.sub_title,this.payButtonTitle=s.order_now_button,this.isEmailRequired=s.is_email_required,this.isTermsRequired=s.show_agreement,this.agreementText=s.agreement,this.confirmPayButtonTitle=s.confirm_button,this.thanksMessage=s.thanks_message,this.quickOrderStyle=s.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((s=>salla.onReady((()=>this.loadQuickOrderSettings().then(s)))))}render(){if(this.isAvailable)return this.submitSucess?i(e,{class:"s-quick-order"},i("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},i("i",{innerHTML:'\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>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),i("span",null,this.thanksMessage))):i(e,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},i("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},i("div",{class:"s-quick-order-button-cont"},i("div",null,i("h3",null,this.quickOrderTitle),i("p",null,this.subTitle)),i("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:s=>this.submit(s,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?i("i",{innerHTML:h}):this.confirmPayButtonTitle)),i("form",{onSubmit:s=>this.submit(s),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[i("div",{class:"s-form-group"},i("span",{innerHTML:'\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>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),i("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:s=>this.nameInput=s})),i("div",{class:"s-quick-order-flex-input"},i("div",{class:"s-form-group"},i("span",{innerHTML:a}),i("salla-tel-input",{ref:s=>this.phoneInput=s})),i("div",{class:"s-form-group"},i("span",{innerHTML:l}),i("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:s=>this.emailInput=s})))],this.isTermsRequired&&i("label",{htmlFor:"terms",class:"s-quick-order-terms"},i("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:s=>this.termsInput=s,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",i("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&i("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),i("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:s=>this.submitBtn=s},this.payButtonTitle)),i("salla-modal",{"modal-title":this.agreementModalHead,ref:s=>this.agreementModal=s},i("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((s=>{s.addEventListener("invalid",(s=>{this.handleInvalidInput(s)})),s.addEventListener("input",(()=>{s.setCustomValidity(""),s.reportValidity()}))}))}get host(){return r(this)}};o.style=".s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}";export{o as salla_quick_order}
|
|
4
|
+
import{r as s,c as t,h as i,H as e,a as r}from"./p-BOjfFBGe.js";import{S as a}from"./p-CciN5Q_x.js";import{e as l}from"./p-DzAIgzdz.js";import{S as h}from"./p-8Tsmrwno.js";const o=class{constructor(i){s(this,i),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(s,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${s}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(s){let t,i=s.target,e=i.validity;e.valueMissing?(t=this.getErrorMessage("field_required",i.name),console.log(this.getErrorMessage("field_required",i.name))):e.typeMismatch&&(t=this.getErrorMessage("invalid_value",i.name)),i.setCustomValidity(t)}async setWrapperHeight(){let s=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{s.style.maxHeight=s.style.maxHeight||this.oneClick?null:s.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(s,t=!1){return s.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((s=>salla.api.cart.createQuickOrder(s))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((s=>s&&(console.error(s),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(s,t=150){return s?s.length<=t?s:(new DOMParser).parseFromString(s,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let s=salla.config.get("store.settings.quick_order");return s?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(s),Promise.resolve()):Promise.resolve()}initComponentData(s){this.quickOrderTitle=s.title,this.subTitle=s.sub_title,this.payButtonTitle=s.order_now_button,this.isEmailRequired=s.is_email_required,this.isTermsRequired=s.show_agreement,this.agreementText=s.agreement,this.confirmPayButtonTitle=s.confirm_button,this.thanksMessage=s.thanks_message,this.quickOrderStyle=s.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((s=>salla.onReady((()=>this.loadQuickOrderSettings().then(s)))))}render(){if(this.isAvailable)return this.submitSucess?i(e,{class:"s-quick-order"},i("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},i("i",{innerHTML:'\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>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),i("span",null,this.thanksMessage))):i(e,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},i("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},i("div",{class:"s-quick-order-button-cont"},i("div",null,i("h3",null,this.quickOrderTitle),i("p",null,this.subTitle)),i("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:s=>this.submit(s,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?i("i",{innerHTML:h}):this.confirmPayButtonTitle)),i("form",{onSubmit:s=>this.submit(s),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[i("div",{class:"s-form-group"},i("span",{innerHTML:'\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>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),i("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:s=>this.nameInput=s})),i("div",{class:"s-quick-order-flex-input"},i("div",{class:"s-form-group"},i("span",{innerHTML:a}),i("salla-tel-input",{ref:s=>this.phoneInput=s})),i("div",{class:"s-form-group"},i("span",{innerHTML:l}),i("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:s=>this.emailInput=s})))],this.isTermsRequired&&i("label",{htmlFor:"terms",class:"s-quick-order-terms"},i("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:s=>this.termsInput=s,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),i("span",{class:"s-form-label"}," ",i("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&i("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),i("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:s=>this.submitBtn=s},this.payButtonTitle)),i("salla-modal",{"modal-title":this.agreementModalHead,ref:s=>this.agreementModal=s},i("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((s=>{s.addEventListener("invalid",(s=>{this.handleInvalidInput(s)})),s.addEventListener("input",(()=>{s.setCustomValidity(""),s.reportValidity()}))}))}get host(){return r(this)}};o.style=".s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}";export{o as salla_quick_order}
|