@salla.sa/twilight-components 3.0.18 → 3.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Helper-D2VNt6eb.js → Helper-C3MBaLHQ.js} +1 -1
- package/dist/cjs/delivery-promise-intent-5WTKLkFZ.js +71 -0
- package/dist/cjs/{filepond-DkCudLhG.js → filepond-DGt10gCq.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-C-uxFWfW.js → filepond-plugin-file-poster-NSV7ClY6.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BikXTQW2.js → filepond-plugin-file-validate-size-C08-fDj7.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-Drs7PouU.js → filepond-plugin-file-validate-type-CbbTh4qd.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-hxr0h9kt.js → filepond-plugin-image-edit-CqqtsmjD.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-CVZmWU_4.js → filepond-plugin-image-exif-orientation-D60HJIiL.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CBjPKx-d.js → filepond-plugin-image-preview-B7bWOXFm.js} +1 -1
- package/dist/cjs/helpers-wRMwEkLy.js +627 -0
- package/dist/cjs/{index-CTYg2zC6.js → index-U-OadFju.js} +14 -10
- package/dist/cjs/{intlTelInput-C9X0hKXV.js → intlTelInput-Cp6WJvPO.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 +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +164 -7
- 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-applied-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +13 -13
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +435 -134
- 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_9.cjs.entry.js +4 -4
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +5 -65
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +2 -2
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-free-shipping-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-free-shipping-tag.cjs.entry.js +1 -1
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gift-card-redeem_2.cjs.entry.js +2 -2
- 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 +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +7 -2
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- 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.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_3.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-mobile-update-modal.cjs.entry.js +188 -0
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +4 -4
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +6 -6
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +2 -2
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item_2.cjs.entry.js +3 -3
- package/dist/cjs/salla-offer-modal.cjs.entry.js +2 -2
- 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 +2 -2
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-items.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-options-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-payment.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-rewards.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +2 -2
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +3 -3
- package/dist/cjs/salla-placeholder.cjs.entry.js +2 -2
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +2 -2
- package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
- package/dist/cjs/salla-products-list.cjs.entry.js +9 -2
- package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +33 -7
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search-product-card.cjs.entry.js +3 -3
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/salla-social-share.cjs.entry.js +2 -2
- package/dist/cjs/salla-social.cjs.entry.js +2 -2
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +4 -4
- package/dist/cjs/salla-thank-you-header.cjs.entry.js +2 -2
- package/dist/cjs/salla-thank-you-page.cjs.entry.js +2 -2
- package/dist/cjs/salla-tiered-offer.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 +2 -2
- package/dist/cjs/salla-verify.cjs.entry.js +3 -3
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +2 -2
- package/dist/cjs/salla-wishlist-summary.cjs.entry.js +2 -2
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-BsLm8rHT.js → vanilla-picker-C-rN_NiT.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-bullet-delivery/api-service.js +156 -25
- package/dist/collection/components/salla-bullet-delivery/helpers.js +166 -15
- package/dist/collection/components/salla-bullet-delivery/icons.js +17 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +490 -52
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +423 -101
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +6 -1
- package/dist/collection/components/salla-mobile-update-modal/salla-mobile-update-modal.css +43 -0
- package/dist/collection/components/salla-mobile-update-modal/salla-mobile-update-modal.js +235 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +1 -1
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -4
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +1 -1
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +1 -1
- package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
- package/dist/collection/components/salla-order-details/salla-order-details.js +1 -1
- package/dist/collection/components/salla-order-edit/salla-order-edit-product-card.js +1 -1
- package/dist/collection/components/salla-order-items/salla-order-items.js +1 -1
- package/dist/collection/components/salla-order-payment/salla-order-payment.js +1 -1
- package/dist/collection/components/salla-order-rewards/salla-order-rewards.js +1 -1
- package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
- package/dist/collection/components/salla-payments/salla-payments.js +2 -2
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-product-card-embed/salla-product-card-embed.js +1 -1
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
- package/dist/collection/components/salla-products-list/salla-products-list.js +7 -0
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +91 -2
- package/dist/collection/components/salla-rating-modal/salla-rating-modal-v2.js +31 -5
- package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
- package/dist/collection/components/salla-review-factors-tags/salla-review-factors-tags.js +1 -1
- package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
- package/dist/collection/components/salla-search-product-card/salla-search-product-card.js +2 -2
- package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +4 -4
- package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
- package/dist/collection/components/salla-social/salla-social.js +1 -1
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
- package/dist/collection/components/salla-thank-you-header/salla-thank-you-header.js +1 -1
- package/dist/collection/components/salla-thank-you-page/salla-thank-you-page.js +1 -1
- package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
- package/dist/collection/components/salla-verify/salla-verify.js +48 -2
- package/dist/collection/components/salla-wishlist-actions/salla-wishlist-actions.js +1 -1
- package/dist/components/delivery-promise-intent.js +67 -0
- package/dist/components/helpers.js +322 -40
- package/dist/components/index.js +2 -2
- package/dist/components/mail.js +2 -2
- package/dist/components/salla-bullet-delivery.js +436 -129
- package/dist/components/salla-contacts.js +2 -2
- package/dist/components/salla-delivery-promise.js +1 -62
- package/dist/components/salla-login-modal2.js +6 -1
- package/dist/components/salla-loyalty-point2.js +2 -2
- package/dist/components/salla-mobile-update-modal.d.ts +11 -0
- package/dist/components/salla-mobile-update-modal.js +241 -0
- package/dist/components/salla-multiple-bundle-product-cart2.js +1 -1
- package/dist/components/salla-multiple-bundle-product-details2.js +2 -2
- package/dist/components/salla-multiple-bundle-product-options-modal2.js +4 -4
- package/dist/components/salla-multiple-bundle-product-slider2.js +1 -1
- package/dist/components/salla-multiple-bundle-product.js +1 -1
- package/dist/components/salla-notification-item2.js +1 -1
- package/dist/components/salla-offer-modal.js +1 -1
- package/dist/components/salla-order-details.js +1 -1
- package/dist/components/salla-order-edit-product-card.js +1 -1
- package/dist/components/salla-order-items2.js +1 -1
- package/dist/components/salla-order-payment.js +1 -1
- package/dist/components/salla-order-rewards.js +1 -1
- package/dist/components/salla-order-summary.js +1 -1
- package/dist/components/salla-payments.js +2 -2
- package/dist/components/salla-placeholder2.js +1 -1
- package/dist/components/salla-product-availability2.js +1 -1
- package/dist/components/salla-product-card-embed.js +1 -1
- package/dist/components/salla-product-size-guide.js +2 -2
- package/dist/components/salla-products-list2.js +7 -0
- package/dist/components/salla-quantity-input2.js +1 -1
- package/dist/components/salla-quick-buy2.js +161 -4
- package/dist/components/salla-quick-order.js +2 -2
- package/dist/components/salla-rating-modal-v22.js +33 -7
- package/dist/components/salla-rating-modal2.js +2 -2
- package/dist/components/salla-review-card2.js +1 -1
- package/dist/components/salla-review-factors-tags2.js +1 -1
- package/dist/components/salla-reviews-page.js +1 -1
- package/dist/components/salla-search-product-card2.js +2 -2
- package/dist/components/salla-searchable-dropdown2.js +4 -4
- package/dist/components/salla-skeleton2.js +1 -1
- package/dist/components/salla-social-share2.js +4 -4
- package/dist/components/salla-social.js +1 -1
- package/dist/components/salla-tab-content2.js +1 -1
- package/dist/components/salla-tab-header2.js +1 -1
- package/dist/components/salla-tabs2.js +1 -1
- package/dist/components/salla-tel-input2.js +1 -1
- package/dist/components/salla-thank-you-header.js +1 -1
- package/dist/components/salla-thank-you-page.js +1 -1
- package/dist/components/salla-tooltip2.js +1 -1
- package/dist/components/salla-user-settings.js +1 -1
- package/dist/components/salla-verify.js +1 -321
- package/dist/components/salla-verify2.js +328 -0
- package/dist/components/salla-wishlist-actions.js +1 -1
- package/dist/docs.json +158 -2
- package/dist/esm/{Helper-C1T-oD4J.js → Helper-BKruFMBN.js} +1 -1
- package/dist/esm/delivery-promise-intent-C6pZjRut.js +67 -0
- package/dist/esm/{filepond-BoWJzHeN.js → filepond-Vl6a--vT.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-B6MkMtuC.js → filepond-plugin-file-poster-CrQqmzd5.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-Dds_462B.js → filepond-plugin-file-validate-size-BrHjddJa.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-DrfGXNay.js → filepond-plugin-file-validate-type-BeMZq9Fl.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CN7eGg-7.js → filepond-plugin-image-edit-DW6JzY39.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CyhxK_6R.js → filepond-plugin-image-exif-orientation-gzIIB75B.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-DdKqAzT9.js → filepond-plugin-image-preview-BwbtnJIU.js} +1 -1
- package/dist/esm/helpers-BVaKfTMx.js +591 -0
- package/dist/esm/{index-DgUQRYr2.js → index-CrXKQnBu.js} +14 -10
- package/dist/esm/{intlTelInput-SwlavcFB.js → intlTelInput-BkjSbnO6.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +164 -7
- 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-applied-filters.entry.js +2 -2
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +13 -13
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-bullet-delivery_3.entry.js +435 -134
- 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_9.entry.js +4 -4
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +3 -63
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +2 -2
- package/dist/esm/salla-filters.entry.js +2 -2
- package/dist/esm/salla-free-shipping-banner.entry.js +1 -1
- package/dist/esm/salla-free-shipping-tag.entry.js +1 -1
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gift-card-redeem_2.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +7 -2
- package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- 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.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_3.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-mobile-update-modal.entry.js +186 -0
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +4 -4
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +6 -6
- package/dist/esm/salla-multiple-bundle-product.entry.js +2 -2
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item_2.entry.js +3 -3
- package/dist/esm/salla-offer-modal.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +2 -2
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-items.entry.js +2 -2
- package/dist/esm/salla-order-options-modal.entry.js +1 -1
- package/dist/esm/salla-order-payment.entry.js +2 -2
- package/dist/esm/salla-order-rewards.entry.js +2 -2
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +2 -2
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +2 -2
- package/dist/esm/salla-payments.entry.js +3 -3
- package/dist/esm/salla-placeholder.entry.js +2 -2
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +2 -2
- package/dist/esm/salla-product-card.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +3 -3
- package/dist/esm/salla-products-list.entry.js +9 -2
- package/dist/esm/salla-products-slider.entry.js +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +33 -7
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-review-factors-tags.entry.js +2 -2
- package/dist/esm/salla-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search-product-card.entry.js +3 -3
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.entry.js +2 -2
- package/dist/esm/salla-social-share.entry.js +2 -2
- package/dist/esm/salla-social.entry.js +2 -2
- package/dist/esm/salla-tab-content_3.entry.js +4 -4
- package/dist/esm/salla-thank-you-header.entry.js +2 -2
- package/dist/esm/salla-thank-you-page.entry.js +2 -2
- package/dist/esm/salla-tiered-offer.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 +2 -2
- package/dist/esm/salla-verify.entry.js +3 -3
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +2 -2
- package/dist/esm/salla-wishlist-summary.entry.js +2 -2
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-Buy50D7t.js → vanilla-picker-eSagUASw.js} +1 -1
- package/dist/twilight/p-0050dd2a.entry.js +4 -0
- package/dist/twilight/{p-3d8b77f7.entry.js → p-012ff05c.entry.js} +1 -1
- package/dist/twilight/{p-08a15c81.entry.js → p-02ce2139.entry.js} +1 -1
- package/dist/twilight/{p-b0d2e31f.entry.js → p-059aa8a9.entry.js} +1 -1
- package/dist/twilight/{p-0d795b58.entry.js → p-09798a10.entry.js} +1 -1
- package/dist/twilight/p-0af7555c.entry.js +4 -0
- package/dist/twilight/{p-bed68e52.entry.js → p-11075f15.entry.js} +1 -1
- package/dist/twilight/{p-6e52b649.entry.js → p-12b2b553.entry.js} +1 -1
- package/dist/twilight/{p-8c1d14f0.entry.js → p-14fb124b.entry.js} +1 -1
- package/dist/twilight/{p-9e0a9a5a.entry.js → p-1ca3525d.entry.js} +1 -1
- package/dist/twilight/{p-7f97335a.entry.js → p-1f54638c.entry.js} +1 -1
- package/dist/twilight/{p-5694edf1.entry.js → p-201c816d.entry.js} +1 -1
- package/dist/twilight/{p-92fd20a0.entry.js → p-203b2723.entry.js} +1 -1
- package/dist/twilight/{p-1af9db24.entry.js → p-224c35e6.entry.js} +1 -1
- package/dist/twilight/{p-6dccd40f.entry.js → p-22bd8281.entry.js} +1 -1
- package/dist/twilight/{p-d4fb9921.entry.js → p-25ac8744.entry.js} +1 -1
- package/dist/twilight/{p-0ba159db.entry.js → p-25b964c0.entry.js} +1 -1
- package/dist/twilight/{p-da0df10b.entry.js → p-2a469c80.entry.js} +1 -1
- package/dist/twilight/{p-26d2b28a.entry.js → p-2a6f93a8.entry.js} +1 -1
- package/dist/twilight/{p-7fd9dc36.entry.js → p-2b0f98fc.entry.js} +1 -1
- package/dist/twilight/{p-259c995a.entry.js → p-2e66576c.entry.js} +1 -1
- package/dist/twilight/{p-be6f8551.entry.js → p-2e8e7cf2.entry.js} +1 -1
- package/dist/twilight/{p-ee479819.entry.js → p-2f05393f.entry.js} +1 -1
- package/dist/twilight/{p-1960020c.entry.js → p-3054e1c1.entry.js} +1 -1
- package/dist/twilight/{p-70dfb2b4.entry.js → p-3295390b.entry.js} +1 -1
- package/dist/twilight/{p-a95b0dc1.entry.js → p-33678067.entry.js} +1 -1
- package/dist/twilight/{p-c4cf0b4d.entry.js → p-33c05de2.entry.js} +1 -1
- package/dist/twilight/{p-d0ff9a3e.entry.js → p-381a9e70.entry.js} +1 -1
- package/dist/twilight/{p-f9e5ed10.entry.js → p-38270121.entry.js} +1 -1
- package/dist/twilight/{p-027cbda6.entry.js → p-385bf37d.entry.js} +1 -1
- package/dist/twilight/{p-d0aeeb7f.entry.js → p-40ee2ca3.entry.js} +1 -1
- package/dist/twilight/{p-cb48a5ef.entry.js → p-43a3401b.entry.js} +1 -1
- package/dist/twilight/{p-9d15f22d.entry.js → p-4616033a.entry.js} +1 -1
- package/dist/twilight/p-484af8cc.entry.js +4 -0
- package/dist/twilight/{p-516e4edc.entry.js → p-4b6627f5.entry.js} +1 -1
- package/dist/twilight/p-4ed8ae08.entry.js +4 -0
- package/dist/twilight/{p-6af8a7b6.entry.js → p-4fb442c2.entry.js} +1 -1
- package/dist/twilight/{p-4b70e6c4.entry.js → p-516f9b83.entry.js} +1 -1
- package/dist/twilight/{p-d1204965.entry.js → p-56aebb36.entry.js} +1 -1
- package/dist/twilight/{p-6b5de500.entry.js → p-56fbe5ff.entry.js} +1 -1
- package/dist/twilight/{p-66ad7a30.entry.js → p-58af47e4.entry.js} +1 -1
- package/dist/twilight/{p-3f842f32.entry.js → p-616e6781.entry.js} +1 -1
- package/dist/twilight/{p-254cff9a.entry.js → p-62077080.entry.js} +1 -1
- package/dist/twilight/p-6427664a.entry.js +4 -0
- package/dist/twilight/{p-bb8b2c85.entry.js → p-65253725.entry.js} +1 -1
- package/dist/twilight/{p-fcb1009f.entry.js → p-6a05f69c.entry.js} +1 -1
- package/dist/twilight/{p-ac736b30.entry.js → p-6afa5aa8.entry.js} +1 -1
- package/dist/twilight/{p-f7a58656.entry.js → p-6ff116eb.entry.js} +1 -1
- package/dist/twilight/{p-f9587127.entry.js → p-710b19d2.entry.js} +1 -1
- package/dist/twilight/{p-84b0e7a9.entry.js → p-71297800.entry.js} +1 -1
- package/dist/twilight/{p-53735934.entry.js → p-7234a066.entry.js} +1 -1
- package/dist/twilight/{p-b1f808f5.entry.js → p-73af6a02.entry.js} +1 -1
- package/dist/twilight/{p-4ab5ee99.entry.js → p-7428deca.entry.js} +1 -1
- package/dist/twilight/{p-b5a45f87.entry.js → p-75b509cd.entry.js} +1 -1
- package/dist/twilight/{p-071aa0e7.entry.js → p-79e446b2.entry.js} +1 -1
- package/dist/twilight/{p-eaf0c514.entry.js → p-7a8c9411.entry.js} +1 -1
- package/dist/twilight/{p-5f6fee0e.entry.js → p-86533832.entry.js} +1 -1
- package/dist/twilight/p-8a4af12c.entry.js +4 -0
- package/dist/twilight/{p-9cf1cfd4.entry.js → p-8ddf6933.entry.js} +1 -1
- package/dist/twilight/{p-7b5f97e7.entry.js → p-93fe31b9.entry.js} +1 -1
- package/dist/twilight/{p-4891c565.entry.js → p-9c96a9e7.entry.js} +1 -1
- package/dist/twilight/{p-CBLWEyM9.js → p-BNr49RmW.js} +1 -1
- package/dist/twilight/{p-DMvhNbgN.js → p-BUzdlb7Q.js} +1 -1
- package/dist/twilight/p-BVaKfTMx.js +4 -0
- package/dist/twilight/{p-BK9YeXWp.js → p-BYWjrTuB.js} +1 -1
- package/dist/twilight/{p-CCwsxMbZ.js → p-Bo_J3Do4.js} +1 -1
- package/dist/twilight/{p-CgNJWeaK.js → p-ChxhrML8.js} +1 -1
- package/dist/twilight/p-CrXKQnBu.js +5 -0
- package/dist/twilight/{p-Y2ZIN9Ok.js → p-D1oKTNWQ.js} +1 -1
- package/dist/twilight/{p-De1tLqQF.js → p-DUNRPrqt.js} +1 -1
- package/dist/twilight/{p-BxQMWsr9.js → p-DUuRpwsl.js} +1 -1
- package/dist/twilight/{p-NqQdbGu6.js → p-DZR3BP63.js} +1 -1
- package/dist/twilight/{p-12a25415.entry.js → p-a52a3664.entry.js} +1 -1
- package/dist/twilight/{p-d346dabd.entry.js → p-a7114995.entry.js} +1 -1
- package/dist/twilight/{p-8c40278d.entry.js → p-aa7494cd.entry.js} +1 -1
- package/dist/twilight/{p-34148827.entry.js → p-ae5d26da.entry.js} +1 -1
- package/dist/twilight/{p-d1121b3f.entry.js → p-b5434bcc.entry.js} +1 -1
- package/dist/twilight/p-b9fabd92.entry.js +4 -0
- package/dist/twilight/{p-bed54154.entry.js → p-bac38ed2.entry.js} +1 -1
- package/dist/twilight/{p-cdeb9bcc.entry.js → p-bbcfcdb0.entry.js} +1 -1
- package/dist/twilight/{p-f7ab5825.entry.js → p-c097cfa1.entry.js} +1 -1
- package/dist/twilight/p-c13e7efb.entry.js +4 -0
- package/dist/twilight/{p-bfd5e263.entry.js → p-d0ea4c3a.entry.js} +1 -1
- package/dist/twilight/{p-a44670a9.entry.js → p-d0ec7ca7.entry.js} +1 -1
- package/dist/twilight/{p-fddf1997.entry.js → p-d31fbdea.entry.js} +1 -1
- package/dist/twilight/{p-37192614.entry.js → p-d482d43e.entry.js} +1 -1
- package/dist/twilight/{p-b3ada3d0.entry.js → p-d5368882.entry.js} +1 -1
- package/dist/twilight/{p-4a3fa153.entry.js → p-d5a2a231.entry.js} +1 -1
- package/dist/twilight/{p-e457e68f.entry.js → p-d6705759.entry.js} +1 -1
- package/dist/twilight/p-d7f2a028.entry.js +4 -0
- package/dist/twilight/{p-0418c2df.entry.js → p-d84dedaf.entry.js} +1 -1
- package/dist/twilight/{p-419d6d71.entry.js → p-d8d9ff09.entry.js} +1 -1
- package/dist/twilight/{p-361f6033.entry.js → p-d902ad13.entry.js} +1 -1
- package/dist/twilight/{p-481f52b1.entry.js → p-d941dc58.entry.js} +1 -1
- package/dist/twilight/{p-8766e236.entry.js → p-dd046bbd.entry.js} +1 -1
- package/dist/twilight/{p-23772523.entry.js → p-dd21db09.entry.js} +1 -1
- package/dist/twilight/{p-3a632c69.entry.js → p-dd83b424.entry.js} +1 -1
- package/dist/twilight/{p-aa35cf98.entry.js → p-e04fb844.entry.js} +1 -1
- package/dist/twilight/{p-6c3084c9.entry.js → p-e60d784c.entry.js} +1 -1
- package/dist/twilight/{p-d8955835.entry.js → p-e6cc7742.entry.js} +1 -1
- package/dist/twilight/{p-5e8d019e.entry.js → p-e853ac07.entry.js} +1 -1
- package/dist/twilight/{p-0f25fedd.entry.js → p-e9ecae21.entry.js} +1 -1
- package/dist/twilight/{p-6ba3808a.entry.js → p-ebe3d316.entry.js} +1 -1
- package/dist/twilight/{p-5bbf17dd.entry.js → p-ec2a45fb.entry.js} +1 -1
- package/dist/twilight/{p-a5b732b3.entry.js → p-ef216c0a.entry.js} +1 -1
- package/dist/twilight/{p-78a56dc6.entry.js → p-f3306980.entry.js} +1 -1
- package/dist/twilight/{p-d9a1bf08.entry.js → p-f65205d5.entry.js} +1 -1
- package/dist/twilight/{p-e9b03e9c.entry.js → p-f6e5cd28.entry.js} +1 -1
- package/dist/twilight/{p-af49191f.entry.js → p-f8cfc9f7.entry.js} +1 -1
- package/dist/twilight/{p-9e65451e.entry.js → p-faa0b9aa.entry.js} +1 -1
- package/dist/twilight/{p-9e042cce.entry.js → p-fb10df18.entry.js} +1 -1
- package/dist/twilight/{p-e38a6793.entry.js → p-fcb1cff7.entry.js} +1 -1
- package/dist/twilight/{p-487b4411.entry.js → p-ff3cb99b.entry.js} +1 -1
- package/dist/twilight/{p-ee65c489.entry.js → p-ff4680ea.entry.js} +1 -1
- package/dist/twilight/p-oL7bxwey.js +9 -0
- package/dist/twilight/p-q5NJ0uS-.js +4 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/api-service.d.ts +23 -7
- package/dist/types/components/salla-bullet-delivery/helpers.d.ts +68 -6
- package/dist/types/components/salla-bullet-delivery/icons.d.ts +14 -0
- package/dist/types/components/salla-bullet-delivery/interfaces.d.ts +40 -1
- package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +73 -4
- package/dist/types/components/salla-mobile-update-modal/salla-mobile-update-modal.d.ts +44 -0
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +18 -0
- package/dist/types/components/salla-rating-modal/salla-rating-modal-v2.d.ts +4 -0
- package/dist/types/components/salla-verify/salla-verify.d.ts +8 -0
- package/dist/types/components.d.ts +50 -0
- package/package.json +5 -5
- package/dist/cjs/helpers-8bMfm_mm.js +0 -329
- package/dist/esm/helpers-DqzaeXrL.js +0 -309
- package/dist/twilight/p-76584a5b.entry.js +0 -4
- package/dist/twilight/p-79822d99.entry.js +0 -4
- package/dist/twilight/p-Ca_SZn0u.js +0 -9
- package/dist/twilight/p-DgUQRYr2.js +0 -5
- package/dist/twilight/p-DqzaeXrL.js +0 -4
- package/dist/twilight/p-b9d67694.entry.js +0 -4
- package/dist/twilight/p-ba6dd59c.entry.js +0 -4
- package/dist/twilight/p-bac25e34.entry.js +0 -4
- package/dist/twilight/p-d1093a59.entry.js +0 -4
- package/dist/twilight/p-e24fbbb4.entry.js +0 -4
- package/dist/twilight/p-eefced26.entry.js +0 -4
|
@@ -325,7 +325,7 @@ export class SallaWishlistActions {
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
render() {
|
|
328
|
-
return (h(Host, { key: '
|
|
328
|
+
return (h(Host, { key: 'ed2bb2b4e6db13b5dc2a8ceb47d0abb4b91da7ea' }, h("div", { key: '9a368503611af6ccce78d35b76ec17bd3ddd296b', class: "s-wishlist-actions" }, h("div", { key: 'a9dc9b280bd46673892d6c72ffc535eb443beb0f', class: "s-wishlist-actions-bar flex items-center justify-end gap-3 mb-3" }, h("div", { key: '90d6ea21a46becdeffca1a9b722a3a20eb3ed341', class: "s-wishlist-actions-dropdown relative" }, h("salla-button", { key: '9edc9eeea5282fc61d48fce5b29ed095793265cf', color: "primary", fill: "outline", type: "button", disabled: !this.hasProducts, "aria-haspopup": "true", "aria-expanded": this.menuOpen ? 'true' : 'false', onClick: () => this.toggleMenu() }, h("div", { key: 'a5a30a3676d304614ec2e8b14172694d00f2e28c', class: "flex flex-row justify-center items-center gap-2" }, h("svg", { key: '6842723fa0aa1f12fba6b91ddc6095a1e8da20af', version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 32 32", style: { width: '16px', height: '16px' } }, h("path", { key: 'c7aa82770d3ce0a04240ee4ab44b8a4f0cf2d8b3', d: "M26.667 21.333c-1.699 0-3.196 0.812-4.173 2.052l-11.912-5.211c0.044-0.276 0.085-0.553 0.085-0.841 0-0.472-0.081-0.923-0.197-1.359l12.361-6.952c0.971 1.009 2.328 1.644 3.836 1.644 2.941 0 5.333-2.392 5.333-5.333s-2.392-5.333-5.333-5.333-5.333 2.392-5.333 5.333c0 0.472 0.081 0.923 0.197 1.359l-12.361 6.952c-0.971-1.009-2.328-1.644-3.836-1.644-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c1.699 0 3.196-0.812 4.173-2.052l11.912 5.211c-0.044 0.276-0.085 0.553-0.085 0.841 0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM26.667 2.667c1.471 0 2.667 1.196 2.667 2.667s-1.196 2.667-2.667 2.667-2.667-1.196-2.667-2.667 1.196-2.667 2.667-2.667zM5.333 20c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM26.667 29.333c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z" })), this.shareLabel, h("svg", { key: '08c44a8306ba2b183aa0549fac2da24c64f3b285', version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 32 32", style: { width: '16px', height: '16px' } }, h("path", { key: '216163cc1b84ceb0b9035c23ef002b80c69ab9bf', d: "M26.212 10.996c-0.556-0.484-1.396-0.428-1.881 0.127l-8.331 9.519-8.331-9.52c-0.485-0.555-1.327-0.611-1.881-0.125s-0.609 1.328-0.124 1.881l9.333 10.667c0.253 0.291 0.617 0.456 1.003 0.456s0.749-0.165 1.003-0.456l9.333-10.667c0.485-0.553 0.429-1.396-0.124-1.881z" })))), this.menuOpen && (h("ul", { key: '57f73a8af50dc9280efde259d639bf3d41434fed', class: "s-wishlist-actions-menu absolute z-20 mt-1 bg-white rounded-lg shadow overflow-hidden" }, h("li", { key: 'd3b5fc449eef1b2af914dcae0dea0b67af599b84' }, h("button", { key: 'e3689eb4db62ff5ee42122819faa28500c555479', type: "button", class: "s-wishlist-actions-menu-item", onClick: () => this.shareAll() }, this.shareAllLabel)), h("li", { key: 'ad40221d90b2ca52ad9544e8d19324ef8af812c4' }, h("button", { key: '9fde093db8640855d4871972b02e3282e9aed6ad', type: "button", class: "s-wishlist-actions-menu-item", onClick: () => this.shareSpecific() }, this.shareSpecificLabel))))), h("salla-social-share", { key: '91287b112e76c9039170ebe54fcbfe7bfcb2dfb1', class: "s-wishlist-actions-social", ref: el => (this.socialShare = el), url: this.shareUrl, mode: "modal", modalTitle: this.shareModalTitle }, h("span", { key: 'e97a4249a046a17d65f214e5c2ecbca2ff21358c', slot: "widget", class: "s-wishlist-actions-social-anchor", "aria-hidden": "true" }))), this.specificMode && (h("div", { key: '50ba30cc24e590986b6031a373f9334e3d8c97a7', class: "s-wishlist-actions-panel flex items-center justify-between gap-4 flex-wrap p-4 mt-3 mb-3 bg-white rounded-lg" }, h("label", { key: '5dbb40eed9828355189d6242131dd07343d19603', class: "s-wishlist-actions-panel-select-all flex items-center gap-2 cursor-pointer" }, h("input", { key: '5bb2571ed6e9d074739fe130d3b3b3bbe77a2393', type: "checkbox", class: "s-products-list-select-checkbox s-wishlist-actions-select-all", checked: this.isAllSelected, ref: el => (this.selectAllCheckbox = el), "aria-label": this.selectAllLabel, onChange: () => this.toggleSelectAll() }), h("span", { key: '60853767d68f23affc964822e41f19fb93b2f380', class: "s-wishlist-actions-panel-title text-sm font-bold text-gray-700" }, this.shareSpecificLabel, " (", this.selectedCount, ")")), h("div", { key: '5d4cab056b372ff6c2d9de0dfa32e1f1870b536a', class: "s-wishlist-actions-panel-buttons flex items-center gap-2" }, h("salla-button", { key: '2ef6d0388714b348ce2e039662c704d0ea9c3afa', class: "s-wishlist-actions-cancel", color: "light", fill: "outline", type: "button", onClick: () => this.cancelSpecific() }, this.cancelLabel), h("salla-button", { key: '0077c263a4eea12fc0b2b1316d4195916d771417', class: "s-wishlist-actions-share", color: "primary", fill: "outline", type: "button", disabled: !this.selectedCount, loading: this.isSharing, onClick: () => this.shareSelected() }, this.shareLabel)))))));
|
|
329
329
|
}
|
|
330
330
|
static get is() { return "salla-wishlist-actions"; }
|
|
331
331
|
static get originalStyleUrls() {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { q as isMapOriginIntent } from './helpers.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bullet delivery intent helpers.
|
|
8
|
+
* Reads/writes the same storage key as salla-bullet-delivery so both components stay in sync.
|
|
9
|
+
*/
|
|
10
|
+
const INTENT_KEY = 'bullet_delivery_intent';
|
|
11
|
+
function getIntentStorage() {
|
|
12
|
+
const rememberLastSession = Boolean(salla.config.get('store.settings.bullet_delivery.settings.remember_last_session'));
|
|
13
|
+
return rememberLastSession ? salla.storage.store : salla.storage.session;
|
|
14
|
+
}
|
|
15
|
+
function getStoredIntent() {
|
|
16
|
+
const raw = getIntentStorage().get(INTENT_KEY);
|
|
17
|
+
return raw && typeof raw === 'object' ? raw : null;
|
|
18
|
+
}
|
|
19
|
+
/** Resolve the stored intent into a city or branch selection. Returns null when no usable intent. */
|
|
20
|
+
function resolveIntent() {
|
|
21
|
+
const intent = getStoredIntent();
|
|
22
|
+
if (!intent)
|
|
23
|
+
return null;
|
|
24
|
+
if (intent.type === 'address') {
|
|
25
|
+
const city = intent.address_details?.city;
|
|
26
|
+
const cityId = city?.id != null ? Number(city.id) : intent.city_id != null ? Number(intent.city_id) : null;
|
|
27
|
+
const cityName = city?.name?.trim() || '';
|
|
28
|
+
if (cityId != null) {
|
|
29
|
+
return { type: 'address', option: { id: cityId, name: cityName } };
|
|
30
|
+
}
|
|
31
|
+
// Map-origin pick: no city id to query a delivery estimate by, but still show the address.
|
|
32
|
+
if (isMapOriginIntent(intent) && intent.address_details?.formatted_address) {
|
|
33
|
+
return { type: 'address', option: { name: intent.address_details.formatted_address } };
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
if (intent.type === 'branch') {
|
|
38
|
+
const branchId = intent.branch_id != null
|
|
39
|
+
? Number(intent.branch_id)
|
|
40
|
+
: intent.branch_details?.id != null
|
|
41
|
+
? Number(intent.branch_details.id)
|
|
42
|
+
: null;
|
|
43
|
+
const branchName = intent.branch_details?.name?.trim() || '';
|
|
44
|
+
if (branchId != null) {
|
|
45
|
+
return { type: 'branch', option: { id: branchId, name: branchName } };
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/** Build the payload for opening the bullet delivery modal with preselection. */
|
|
52
|
+
function buildBulletOpenPayload() {
|
|
53
|
+
const intent = getStoredIntent();
|
|
54
|
+
const payload = {};
|
|
55
|
+
if (intent?.type === 'address' && intent.address_id != null) {
|
|
56
|
+
payload.preselected_address_id = Number(intent.address_id);
|
|
57
|
+
}
|
|
58
|
+
if (intent?.type === 'branch') {
|
|
59
|
+
const branchId = intent.branch_id ?? intent.branch_details?.id;
|
|
60
|
+
if (branchId != null) {
|
|
61
|
+
payload.preselected_branch_id = Number(branchId);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return payload;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { buildBulletOpenPayload as b, getStoredIntent as g, resolveIntent as r };
|
|
@@ -21,6 +21,8 @@ async function withApiErrorHandling(fn, fallback, logLabel) {
|
|
|
21
21
|
}
|
|
22
22
|
const apiCache = new Map();
|
|
23
23
|
const CACHE_TTL = 5 * 60 * 1000;
|
|
24
|
+
let branchCacheGeneration = 0;
|
|
25
|
+
const resolvedBranchPages = new WeakMap();
|
|
24
26
|
function getCached(key) {
|
|
25
27
|
const entry = apiCache.get(key);
|
|
26
28
|
if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -32,6 +34,47 @@ function getCached(key) {
|
|
|
32
34
|
function setCache(key, data) {
|
|
33
35
|
apiCache.set(key, { data, timestamp: Date.now() });
|
|
34
36
|
}
|
|
37
|
+
function getCountryBranches(branches, countryId) {
|
|
38
|
+
if (!branches || countryId == null)
|
|
39
|
+
return branches;
|
|
40
|
+
if (branches.some(branch => branch.country?.id == null))
|
|
41
|
+
return null;
|
|
42
|
+
const matches = branches.filter(branch => String(branch.country?.id) === String(countryId));
|
|
43
|
+
return matches.length ? matches : null;
|
|
44
|
+
}
|
|
45
|
+
function getBranchPage({ query, lat, lng, country_id, city_id, page, per_page = 20 }, cachePage = true) {
|
|
46
|
+
const params = { per_page };
|
|
47
|
+
if (query && query.trim().length >= 2)
|
|
48
|
+
params.query = query;
|
|
49
|
+
if (lat)
|
|
50
|
+
params.lat = Number(lat).toFixed(6);
|
|
51
|
+
if (lng)
|
|
52
|
+
params.lng = Number(lng).toFixed(6);
|
|
53
|
+
if (country_id)
|
|
54
|
+
params.country_id = country_id;
|
|
55
|
+
if (city_id)
|
|
56
|
+
params.city_id = city_id;
|
|
57
|
+
if (page && page > 1)
|
|
58
|
+
params.page = page;
|
|
59
|
+
const cacheKey = `branches_${JSON.stringify(params)}`;
|
|
60
|
+
const cached = cachePage ? getCached(cacheKey) : null;
|
|
61
|
+
if (cached)
|
|
62
|
+
return cached;
|
|
63
|
+
const request = (async () => {
|
|
64
|
+
const res = await salla.api.request('branches', { params });
|
|
65
|
+
if (!Array.isArray(res?.data))
|
|
66
|
+
throw new Error('Invalid branches response');
|
|
67
|
+
return { branches: res.data, perPage: per_page, pagination: res.pagination };
|
|
68
|
+
})();
|
|
69
|
+
if (cachePage)
|
|
70
|
+
setCache(cacheKey, request);
|
|
71
|
+
void request.then(page => { resolvedBranchPages.set(request, page); }, () => { });
|
|
72
|
+
void request.catch(() => {
|
|
73
|
+
if (apiCache.get(cacheKey)?.data === request)
|
|
74
|
+
apiCache.delete(cacheKey);
|
|
75
|
+
});
|
|
76
|
+
return request;
|
|
77
|
+
}
|
|
35
78
|
/** Uses country code from API (e.g. 'SA'). */
|
|
36
79
|
const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
|
|
37
80
|
/**
|
|
@@ -141,30 +184,105 @@ const bulletDeliveryAPI = {
|
|
|
141
184
|
return Array.isArray(data) ? data : [];
|
|
142
185
|
}, [], 'Error fetching user addresses');
|
|
143
186
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
187
|
+
/** Complete country rows for the city picker; incomplete reads remain retryable. */
|
|
188
|
+
async getAllBranches(country_id, per_page = 20) {
|
|
189
|
+
const collection = await this.getBranchCollection(country_id, per_page, { maxPages: Number.POSITIVE_INFINITY });
|
|
190
|
+
if (!collection.complete)
|
|
191
|
+
throw Object.assign(new Error('Incomplete branch city collection'), { branches: collection.branches });
|
|
192
|
+
return collection.branches;
|
|
193
|
+
},
|
|
194
|
+
/** Keeps loaded branches separate from whether the collection is complete. */
|
|
195
|
+
async getBranchCollection(country_id, per_page = 20, { maxPages = 10, requireComplete = false } = {}) {
|
|
196
|
+
const generation = branchCacheGeneration;
|
|
197
|
+
const cacheKey = `branches_all_${JSON.stringify([country_id ?? null, per_page, maxPages, requireComplete])}`;
|
|
198
|
+
const cached = Number.isFinite(maxPages) ? getCached(cacheKey) : null;
|
|
199
|
+
if (cached)
|
|
200
|
+
return cached;
|
|
201
|
+
const storeBranches = country_id != null ? getCached('branches_all') : null;
|
|
202
|
+
if (country_id == null)
|
|
203
|
+
setCache('branches_first', getBranchPage({ per_page, page: 1 }));
|
|
204
|
+
const partial = { branches: [], complete: false };
|
|
205
|
+
const request = withApiErrorHandling(async () => {
|
|
206
|
+
const sharedFirstPage = storeBranches ? getCached('branches_first') : null;
|
|
207
|
+
const first = sharedFirstPage ? resolvedBranchPages.get(sharedFirstPage) : null;
|
|
208
|
+
if (storeBranches && getCountryBranches(first?.branches ?? null, country_id)) {
|
|
209
|
+
const collection = await storeBranches;
|
|
210
|
+
if (generation !== branchCacheGeneration)
|
|
211
|
+
return { branches: [], complete: false };
|
|
212
|
+
const branches = collection.complete ? getCountryBranches(collection.branches, country_id) : null;
|
|
213
|
+
if (branches)
|
|
214
|
+
return { branches, complete: true };
|
|
215
|
+
}
|
|
216
|
+
for (let page = 1; page <= maxPages; page++) {
|
|
217
|
+
const { branches, pagination } = await getBranchPage({ country_id, per_page, page }, Number.isFinite(maxPages) || page === 1);
|
|
218
|
+
if (generation !== branchCacheGeneration)
|
|
219
|
+
return { branches: [], complete: false };
|
|
220
|
+
const currentPage = Number(pagination?.currentPage ?? page);
|
|
221
|
+
const totalPages = Number(pagination?.totalPages);
|
|
222
|
+
if (page === 1 && totalPages === 0 && !branches.length)
|
|
223
|
+
return { branches: [], complete: true };
|
|
224
|
+
if (pagination && (currentPage !== page || !Number.isInteger(totalPages) || totalPages < page)) {
|
|
225
|
+
throw new Error('Invalid branches pagination');
|
|
226
|
+
}
|
|
227
|
+
partial.branches.push(...branches);
|
|
228
|
+
if (pagination) {
|
|
229
|
+
if (requireComplete && totalPages > maxPages)
|
|
230
|
+
return partial;
|
|
231
|
+
if (page === totalPages)
|
|
232
|
+
return { branches: partial.branches, complete: true };
|
|
233
|
+
if (!branches.length)
|
|
234
|
+
throw new Error('Incomplete branches response');
|
|
235
|
+
}
|
|
236
|
+
else if (branches.length < per_page) {
|
|
237
|
+
return { branches: partial.branches, complete: true };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return partial;
|
|
241
|
+
}, partial, 'Error fetching all branches');
|
|
242
|
+
setCache(cacheKey, request);
|
|
243
|
+
if (country_id == null)
|
|
244
|
+
setCache('branches_all', request);
|
|
245
|
+
void request.then(collection => {
|
|
246
|
+
if (collection.complete) {
|
|
247
|
+
if (generation === branchCacheGeneration && apiCache.get('branches_all')?.data === request) {
|
|
248
|
+
setCache('branches_complete', collection.branches);
|
|
249
|
+
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (apiCache.get(cacheKey)?.data === request)
|
|
253
|
+
apiCache.delete(cacheKey);
|
|
254
|
+
if (apiCache.get('branches_all')?.data === request)
|
|
255
|
+
apiCache.delete('branches_all');
|
|
256
|
+
});
|
|
257
|
+
return request;
|
|
258
|
+
},
|
|
259
|
+
async getBranches(filters = {}) {
|
|
260
|
+
const generation = branchCacheGeneration;
|
|
261
|
+
const hasSearchParams = (filters.query && filters.query.trim().length >= 2) || filters.lat || filters.lng || filters.city_id;
|
|
262
|
+
const perPage = filters.per_page ?? 20;
|
|
263
|
+
const offset = ((filters.page ?? 1) - 1) * perPage;
|
|
264
|
+
if (!hasSearchParams) {
|
|
265
|
+
const branches = getCountryBranches(getCached('branches_complete'), filters.country_id);
|
|
266
|
+
if (branches) {
|
|
267
|
+
return branches.slice(offset, offset + perPage);
|
|
268
|
+
}
|
|
269
|
+
const firstPage = getCached('branches_first');
|
|
270
|
+
if (firstPage) {
|
|
271
|
+
const result = resolvedBranchPages.get(firstPage);
|
|
272
|
+
if (generation !== branchCacheGeneration)
|
|
273
|
+
return [];
|
|
274
|
+
if (result) {
|
|
275
|
+
const first = getCountryBranches(result.branches, filters.country_id);
|
|
276
|
+
const complete = result.pagination
|
|
277
|
+
? Number(result.pagination.totalPages) === 1
|
|
278
|
+
: result.branches.length < result.perPage;
|
|
279
|
+
if (first && (first.length >= offset + perPage || complete)) {
|
|
280
|
+
return first.slice(offset, offset + perPage);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
151
284
|
}
|
|
152
|
-
|
|
153
|
-
const params = { per_page };
|
|
154
|
-
if (query?.trim().length >= 2)
|
|
155
|
-
params.query = query;
|
|
156
|
-
if (lat)
|
|
157
|
-
params.lat = lat;
|
|
158
|
-
if (lng)
|
|
159
|
-
params.lng = lng;
|
|
160
|
-
if (country_id)
|
|
161
|
-
params.country_id = country_id;
|
|
162
|
-
const res = await salla.api.request("branches", { params });
|
|
163
|
-
return (Array.isArray(res?.data) ? res.data : []);
|
|
164
|
-
}, [], 'Error fetching branches');
|
|
165
|
-
if (cacheKey && result.length > 0)
|
|
166
|
-
setCache(cacheKey, result);
|
|
167
|
-
return result;
|
|
285
|
+
return withApiErrorHandling(async () => (await getBranchPage(filters)).branches, [], 'Error fetching branches');
|
|
168
286
|
},
|
|
169
287
|
async saveAddressLocation(payload) {
|
|
170
288
|
return withApiErrorHandling(async () => {
|
|
@@ -182,7 +300,12 @@ const bulletDeliveryAPI = {
|
|
|
182
300
|
}, false, 'Error setting delivery scope');
|
|
183
301
|
},
|
|
184
302
|
async allocateScope(payload) {
|
|
185
|
-
|
|
303
|
+
// A field reason (e.g. branch_id "not accepting orders") is more useful than the generic "invalid fields" message.
|
|
304
|
+
const errMsg = (d) => {
|
|
305
|
+
const body = d;
|
|
306
|
+
const fieldReason = Object.values(body?.error?.fields ?? {}).flat().find((m) => typeof m === 'string' && m.trim());
|
|
307
|
+
return fieldReason ?? body?.error?.message ?? body?.message ?? 'Failed to allocate scope';
|
|
308
|
+
};
|
|
186
309
|
try {
|
|
187
310
|
const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
|
|
188
311
|
// SDK resolves with { data } and throws on non-2xx; any resolved value is success
|
|
@@ -203,8 +326,16 @@ const bulletDeliveryAPI = {
|
|
|
203
326
|
},
|
|
204
327
|
};
|
|
205
328
|
function clearApiCache() {
|
|
329
|
+
branchCacheGeneration++;
|
|
206
330
|
apiCache.clear();
|
|
207
331
|
}
|
|
332
|
+
function clearBranchCache() {
|
|
333
|
+
branchCacheGeneration++;
|
|
334
|
+
for (const key of apiCache.keys()) {
|
|
335
|
+
if (key.startsWith('branches_'))
|
|
336
|
+
apiCache.delete(key);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
208
339
|
|
|
209
340
|
/**
|
|
210
341
|
* Helper functions for salla-bullet-delivery component
|
|
@@ -233,13 +364,153 @@ const isBranchSelectable = (branch) => {
|
|
|
233
364
|
const selectable = branch.pickup_readiness?.selectable;
|
|
234
365
|
return typeof selectable === 'boolean' ? selectable : branch.is_open !== false;
|
|
235
366
|
};
|
|
236
|
-
/**
|
|
367
|
+
/** Backend readiness label ("استلمه غدًا", "جاهز {date}") when pickup is not today; null otherwise. */
|
|
368
|
+
const getBranchReadinessLabel = (branch) => {
|
|
369
|
+
const readiness = branch?.pickup_readiness;
|
|
370
|
+
return readiness?.label && ['tomorrow', 'later'].includes(readiness.state) ? readiness.label : null;
|
|
371
|
+
};
|
|
372
|
+
/** Branch-clock "HH:mm" a branch that is closed now becomes ready at later today; null otherwise. */
|
|
373
|
+
const getBranchReadyTodayTime = (branch) => {
|
|
374
|
+
const readiness = branch?.pickup_readiness;
|
|
375
|
+
if (readiness?.state !== 'same_day' || branch?.is_open !== false)
|
|
376
|
+
return null;
|
|
377
|
+
return readiness.ready_at?.match(/T(\d{2}:\d{2})/)?.[1] ?? null;
|
|
378
|
+
};
|
|
379
|
+
/** Busy branches (stock at the merchant's stop-orders threshold) stay listed but dimmed and unselectable. */
|
|
380
|
+
const isBranchBusy = (branch) => branch?.pickup_readiness?.state === 'orders_paused';
|
|
381
|
+
/** Distinct cities of a branch list, in first-seen order (the API lists nearest first). */
|
|
382
|
+
const getBranchCities = (branches) => {
|
|
383
|
+
const seen = new Set();
|
|
384
|
+
const cities = [];
|
|
385
|
+
for (const { city } of branches) {
|
|
386
|
+
if (!city?.id || seen.has(String(city.id)))
|
|
387
|
+
continue;
|
|
388
|
+
seen.add(String(city.id));
|
|
389
|
+
cities.push({ id: city.id, name: city.name });
|
|
390
|
+
}
|
|
391
|
+
return cities;
|
|
392
|
+
};
|
|
393
|
+
/** "3.52" / "12" — at most two decimals, as the checkout picker shows it; '' when the distance is unknown. */
|
|
394
|
+
const formatBranchDistance = (km) => {
|
|
395
|
+
if (km == null || Number.isNaN(Number(km)))
|
|
396
|
+
return '';
|
|
397
|
+
return String(Math.round(Number(km) * 100) / 100);
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Readiness states the picker hides outright instead of showing as a disabled card: closed and not
|
|
401
|
+
* taking pickup orders at all. Busy/out-of-stock stay visible-but-disabled so the shopper sees why
|
|
402
|
+
* (same rule as the checkout picker, INV-1414).
|
|
403
|
+
*/
|
|
404
|
+
const HIDDEN_READINESS_STATES = ['closed', 'unavailable'];
|
|
405
|
+
const isBranchVisible = (branch) => !!branch && !HIDDEN_READINESS_STATES.includes(branch.pickup_readiness?.state);
|
|
406
|
+
/** The branch's pickup offer (INV-1416); null when it has none, or a zero one, so "خصم 0%" never shows. */
|
|
407
|
+
const getBranchDiscount = (branch) => {
|
|
408
|
+
const type = branch?.discount?.type;
|
|
409
|
+
const amount = Number(branch?.discount?.amount);
|
|
410
|
+
if ((type !== 'percentage' && type !== 'fixed_amount') || !(amount > 0))
|
|
411
|
+
return null;
|
|
412
|
+
return { type, amount };
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* Min–max pickup offer across the listed branches, for the pickup tab badge; null when none has one.
|
|
416
|
+
* Branches the picker hides are left out so the tab never advertises an offer the shopper can't pick.
|
|
417
|
+
* A percentage and a fixed amount can't share one range, so percentages win when both are set.
|
|
418
|
+
*/
|
|
419
|
+
const getBranchDiscountRange = (branches) => {
|
|
420
|
+
const discounts = branches.filter(isBranchVisible).map(getBranchDiscount).filter((d) => !!d);
|
|
421
|
+
if (!discounts.length)
|
|
422
|
+
return null;
|
|
423
|
+
const type = discounts.some(d => d.type === 'percentage') ? 'percentage' : 'fixed_amount';
|
|
424
|
+
const amounts = discounts.filter(d => d.type === type).map(d => d.amount);
|
|
425
|
+
return { type, min: Math.min(...amounts), max: Math.max(...amounts) };
|
|
426
|
+
};
|
|
427
|
+
/** The storefront's working_hours and ready_at use 24h "HH:mm"; null for anything else. */
|
|
428
|
+
const parseBranchTime = (time) => {
|
|
429
|
+
const match = String(time ?? '').trim().match(/^(\d{1,2}):(\d{2})(?::\d{2})?$/);
|
|
430
|
+
if (!match || Number(match[1]) > 24)
|
|
431
|
+
return null;
|
|
432
|
+
return { hours: Number(match[1]) % 24, minutes: Number(match[2]) };
|
|
433
|
+
};
|
|
434
|
+
/** Date#getDay() keys for the day names the storefront API may send (Arabic or English). */
|
|
435
|
+
const DAY_KEYS = {
|
|
436
|
+
sunday: 0, 'الاحد': 0,
|
|
437
|
+
monday: 1, 'الاثنين': 1,
|
|
438
|
+
tuesday: 2, 'الثلاثاء': 2,
|
|
439
|
+
wednesday: 3, 'الاربعاء': 3,
|
|
440
|
+
thursday: 4, 'الخميس': 4,
|
|
441
|
+
friday: 5, 'الجمعة': 5,
|
|
442
|
+
saturday: 6, 'السبت': 6,
|
|
443
|
+
};
|
|
444
|
+
const dayKeyFromName = (name) => DAY_KEYS[String(name ?? '').trim().toLowerCase().replace(/[أإآ]/g, 'ا')];
|
|
445
|
+
/**
|
|
446
|
+
* The storefront's `working_hours` (`{ name, times: [{ from, to }] }`, 24h times) as weekly
|
|
447
|
+
* schedule rows for the hours dropdown.
|
|
448
|
+
*/
|
|
449
|
+
const getBranchWeekSchedule = (branch) => (branch.working_hours || [])
|
|
450
|
+
.filter(day => day?.name)
|
|
451
|
+
.map(day => ({
|
|
452
|
+
day_key: dayKeyFromName(day.name),
|
|
453
|
+
day: day.name,
|
|
454
|
+
times: (day.times || []).map(t => ({ start: t.from, end: t.to })),
|
|
455
|
+
}));
|
|
456
|
+
const isBranchAlwaysOpen = (branch) => !!branch.always_open;
|
|
457
|
+
/**
|
|
458
|
+
* "11:00 م" / "11:00 PM". ar-SA's ICU pattern puts the day period first, which the bidi algorithm
|
|
459
|
+
* scrambles inside RTL text, so the parts are joined in a fixed "h:mm period" order instead.
|
|
460
|
+
*/
|
|
461
|
+
const formatBranchClockTime = (time, locale) => {
|
|
462
|
+
const parsed = parseBranchTime(time);
|
|
463
|
+
if (!parsed)
|
|
464
|
+
return '';
|
|
465
|
+
const date = new Date(Date.UTC(2000, 0, 1, parsed.hours, parsed.minutes));
|
|
466
|
+
const parts = new Intl.DateTimeFormat(locale === 'ar' ? 'ar-SA-u-nu-latn' : 'en', {
|
|
467
|
+
timeZone: 'UTC',
|
|
468
|
+
hour: '2-digit',
|
|
469
|
+
minute: '2-digit',
|
|
470
|
+
hour12: true,
|
|
471
|
+
}).formatToParts(date);
|
|
472
|
+
const get = (type) => parts.find(p => p.type === type)?.value ?? '';
|
|
473
|
+
return `${get('hour')}:${get('minute')} ${get('dayPeriod')}`;
|
|
474
|
+
};
|
|
475
|
+
const sameTimes = (a, b) => a.length === b.length && a.every((t, i) => t.start === b[i].start && t.end === b[i].end);
|
|
476
|
+
/** Consecutive days with identical hours collapse into one row; the largest groups come first. */
|
|
477
|
+
const groupBranchSchedule = (weekSchedule) => {
|
|
478
|
+
const groups = [];
|
|
479
|
+
const days = [...(weekSchedule || [])].filter(s => s.times?.length).sort((a, b) => (a.day_key ?? 0) - (b.day_key ?? 0));
|
|
480
|
+
for (const day of days) {
|
|
481
|
+
const last = groups[groups.length - 1];
|
|
482
|
+
if (last && day.day_key === last.lastDayKey + 1 && sameTimes(last.times, day.times)) {
|
|
483
|
+
last.days.push(day.day);
|
|
484
|
+
last.lastDayKey = day.day_key;
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
groups.push({ days: [day.day], times: day.times, lastDayKey: day.day_key ?? 0 });
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return groups.sort((a, b) => b.days.length - a.days.length).map(({ days, times }) => ({ days, times }));
|
|
491
|
+
};
|
|
492
|
+
/** Keeps the digits and a leading "+" the merchant typed; drops spaces, dashes and brackets. */
|
|
493
|
+
const cleanPhone = (value) => String(value ?? '').trim().replace(/[^\d+]/g, '');
|
|
494
|
+
const getBranchPhoneHref = (branch) => {
|
|
495
|
+
const phone = cleanPhone(branch.contacts?.phone);
|
|
496
|
+
return phone ? `tel:${phone}` : null;
|
|
497
|
+
};
|
|
498
|
+
/** wa.me wants the international number as bare digits ("+966…" / "00966…" → "966…"). */
|
|
499
|
+
const getBranchWhatsappHref = (branch) => {
|
|
500
|
+
const digits = cleanPhone(branch.contacts?.whatsapp).replace(/^\+/, '').replace(/^00/, '').replace(/\D/g, '');
|
|
501
|
+
return digits ? `https://wa.me/${digits}` : null;
|
|
502
|
+
};
|
|
503
|
+
const getBranchDirectionsHref = (branch) => branch.location?.lat != null && branch.location?.lng != null
|
|
504
|
+
? `https://www.google.com/maps?q=${branch.location.lat},${branch.location.lng}`
|
|
505
|
+
: null;
|
|
506
|
+
/** Nearest selectable branch by distance; single pass O(n). */
|
|
237
507
|
function findNearestBranch(branches, userLat, userLon) {
|
|
238
508
|
let nearest = null;
|
|
239
509
|
let minD = Number.POSITIVE_INFINITY;
|
|
240
510
|
for (const b of branches) {
|
|
241
511
|
const lat = b.location?.lat != null ? Number(b.location.lat) : Number.NaN;
|
|
242
512
|
const lng = b.location?.lng != null ? Number(b.location.lng) : Number.NaN;
|
|
513
|
+
// Closed branches that still take orders are selectable too, so gate on selectability, not is_open.
|
|
243
514
|
if (Number.isNaN(lat) || Number.isNaN(lng) || !isBranchSelectable(b))
|
|
244
515
|
continue;
|
|
245
516
|
const d = calculateDistance(userLat, userLon, lat, lng);
|
|
@@ -250,11 +521,12 @@ function findNearestBranch(branches, userLat, userLon) {
|
|
|
250
521
|
}
|
|
251
522
|
return nearest;
|
|
252
523
|
}
|
|
524
|
+
/** Matches the fields the branches API searches: branch, city and country names (either language). */
|
|
253
525
|
const filterBranches = (branches, searchQuery) => {
|
|
254
526
|
if (!searchQuery)
|
|
255
527
|
return branches;
|
|
256
528
|
const q = searchQuery.toLowerCase();
|
|
257
|
-
return branches.filter((b) => b.name.
|
|
529
|
+
return branches.filter((b) => [b.name, b.city?.name, b.city?.name_en, b.country?.name, b.country?.name_en].some((name) => name?.toLowerCase().includes(q)));
|
|
258
530
|
};
|
|
259
531
|
const getIntentSubtitle = (intent, toAddress, fromBranch) => {
|
|
260
532
|
if (intent.type === 'branch') {
|
|
@@ -274,10 +546,30 @@ const getIntentRegionId = (i) => idFrom(i?.address_details?.region?.id);
|
|
|
274
546
|
const getIntentCityId = (i) => idFrom(i?.address_details?.city?.id);
|
|
275
547
|
const getIntentDistrictId = (i) => idFrom(i?.address_details?.district?.id);
|
|
276
548
|
const getIntentBranchId = (i) => i?.branch_details?.id;
|
|
277
|
-
/** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
|
|
278
|
-
const getIntentLatitude = (i) => i?.branch_details?.latitude;
|
|
279
|
-
const getIntentLongitude = (i) => i?.branch_details?.longitude;
|
|
280
549
|
const isMapOriginIntent = (i) => !!i && i.type === 'address' && i.address_details?.lat != null && i.address_details?.lng != null;
|
|
550
|
+
/** Parse a coordinate to a finite number, treating null and blank/whitespace strings as missing. */
|
|
551
|
+
const toCoordinate = (value) => {
|
|
552
|
+
if (value == null || (typeof value === 'string' && value.trim() === ''))
|
|
553
|
+
return null;
|
|
554
|
+
const num = Number(value);
|
|
555
|
+
return Number.isFinite(num) ? num : null;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Address intent complete enough to order against: a national address code, or a district with a
|
|
559
|
+
* street or real coordinates. The district text may sit in `local` when the district object is empty.
|
|
560
|
+
*/
|
|
561
|
+
const isIntentAddressComplete = (i) => {
|
|
562
|
+
if (!i || i.type !== 'address')
|
|
563
|
+
return false;
|
|
564
|
+
const d = i.address_details;
|
|
565
|
+
// Stored intents come from the API, so a field may not be a string.
|
|
566
|
+
const has = (value) => String(value ?? '').trim() !== '';
|
|
567
|
+
const lat = toCoordinate(d?.lat);
|
|
568
|
+
const lng = toCoordinate(d?.lng);
|
|
569
|
+
const hasCoordinates = lat != null && lng != null && !(lat === 0 && lng === 0);
|
|
570
|
+
const hasDistrict = has(d?.district?.name) || has(d?.local);
|
|
571
|
+
return has(d?.short_address) || (hasDistrict && (has(d?.street) || hasCoordinates));
|
|
572
|
+
};
|
|
281
573
|
const hasSessionAddressIntent = (intent) => {
|
|
282
574
|
if (!intent || intent.type !== 'address' || intent.address_id)
|
|
283
575
|
return false;
|
|
@@ -295,15 +587,5 @@ const hasSessionAddressIntent = (intent) => {
|
|
|
295
587
|
const requireRegionAndDistrictForSA = (countryCode, regionId, districtIdOrName) => !countryCode || !isSaudiArabia(countryCode)
|
|
296
588
|
? true
|
|
297
589
|
: (regionId != null && Number(regionId) !== 0) && (districtIdOrName != null && (typeof districtIdOrName === 'number' ? districtIdOrName !== 0 : String(districtIdOrName).trim().length > 0));
|
|
298
|
-
// Geolocation error codes - fallback constants for non-browser environments
|
|
299
|
-
const GEO_ERROR_PERMISSION_DENIED = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.PERMISSION_DENIED : 1;
|
|
300
|
-
const GEO_ERROR_POSITION_UNAVAILABLE = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.POSITION_UNAVAILABLE : 2;
|
|
301
|
-
const GEO_ERROR_TIMEOUT = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.TIMEOUT : 3;
|
|
302
|
-
const GEO_ERROR_MESSAGES = {
|
|
303
|
-
[GEO_ERROR_PERMISSION_DENIED]: 'Location permission denied',
|
|
304
|
-
[GEO_ERROR_POSITION_UNAVAILABLE]: 'Location unavailable',
|
|
305
|
-
[GEO_ERROR_TIMEOUT]: 'Location timeout',
|
|
306
|
-
};
|
|
307
|
-
const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
|
|
308
590
|
|
|
309
|
-
export {
|
|
591
|
+
export { formatBranchDistance as A, getBranchDirectionsHref as B, CACHE_TTL as C, formatBranchClockTime as D, getBranchReadyTodayTime as E, isBranchBusy as F, isBranchAlwaysOpen as G, getIntentCountryCode as H, isIntentAddressComplete as I, getIntentCountryId as a, bulletDeliveryAPI as b, clearBranchCache as c, getIntentRegionId as d, getIntentDistrictId as e, getBranchCities as f, getIntentCityId as g, hasSessionAddressIntent as h, isSaudiArabia as i, isBranchSelectable as j, getBranchDiscountRange as k, filterBranches as l, getIntentBranchId as m, findNearestBranch as n, clearApiCache as o, getIntentSubtitle as p, isMapOriginIntent as q, requireRegionAndDistrictForSA as r, isBranchVisible as s, toCoordinate as t, getBranchReadinessLabel as u, groupBranchSchedule as v, getBranchWeekSchedule as w, getBranchPhoneHref as x, getBranchWhatsappHref as y, getBranchDiscount as z };
|