@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
|
@@ -31,13 +31,153 @@ export const isBranchSelectable = (branch) => {
|
|
|
31
31
|
const selectable = branch.pickup_readiness?.selectable;
|
|
32
32
|
return typeof selectable === 'boolean' ? selectable : branch.is_open !== false;
|
|
33
33
|
};
|
|
34
|
-
/**
|
|
34
|
+
/** Backend readiness label ("استلمه غدًا", "جاهز {date}") when pickup is not today; null otherwise. */
|
|
35
|
+
export const getBranchReadinessLabel = (branch) => {
|
|
36
|
+
const readiness = branch?.pickup_readiness;
|
|
37
|
+
return readiness?.label && ['tomorrow', 'later'].includes(readiness.state) ? readiness.label : null;
|
|
38
|
+
};
|
|
39
|
+
/** Branch-clock "HH:mm" a branch that is closed now becomes ready at later today; null otherwise. */
|
|
40
|
+
export const getBranchReadyTodayTime = (branch) => {
|
|
41
|
+
const readiness = branch?.pickup_readiness;
|
|
42
|
+
if (readiness?.state !== 'same_day' || branch?.is_open !== false)
|
|
43
|
+
return null;
|
|
44
|
+
return readiness.ready_at?.match(/T(\d{2}:\d{2})/)?.[1] ?? null;
|
|
45
|
+
};
|
|
46
|
+
/** Busy branches (stock at the merchant's stop-orders threshold) stay listed but dimmed and unselectable. */
|
|
47
|
+
export const isBranchBusy = (branch) => branch?.pickup_readiness?.state === 'orders_paused';
|
|
48
|
+
/** Distinct cities of a branch list, in first-seen order (the API lists nearest first). */
|
|
49
|
+
export const getBranchCities = (branches) => {
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const cities = [];
|
|
52
|
+
for (const { city } of branches) {
|
|
53
|
+
if (!city?.id || seen.has(String(city.id)))
|
|
54
|
+
continue;
|
|
55
|
+
seen.add(String(city.id));
|
|
56
|
+
cities.push({ id: city.id, name: city.name });
|
|
57
|
+
}
|
|
58
|
+
return cities;
|
|
59
|
+
};
|
|
60
|
+
/** "3.52" / "12" — at most two decimals, as the checkout picker shows it; '' when the distance is unknown. */
|
|
61
|
+
export const formatBranchDistance = (km) => {
|
|
62
|
+
if (km == null || Number.isNaN(Number(km)))
|
|
63
|
+
return '';
|
|
64
|
+
return String(Math.round(Number(km) * 100) / 100);
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Readiness states the picker hides outright instead of showing as a disabled card: closed and not
|
|
68
|
+
* taking pickup orders at all. Busy/out-of-stock stay visible-but-disabled so the shopper sees why
|
|
69
|
+
* (same rule as the checkout picker, INV-1414).
|
|
70
|
+
*/
|
|
71
|
+
const HIDDEN_READINESS_STATES = ['closed', 'unavailable'];
|
|
72
|
+
export const isBranchVisible = (branch) => !!branch && !HIDDEN_READINESS_STATES.includes(branch.pickup_readiness?.state);
|
|
73
|
+
/** The branch's pickup offer (INV-1416); null when it has none, or a zero one, so "خصم 0%" never shows. */
|
|
74
|
+
export const getBranchDiscount = (branch) => {
|
|
75
|
+
const type = branch?.discount?.type;
|
|
76
|
+
const amount = Number(branch?.discount?.amount);
|
|
77
|
+
if ((type !== 'percentage' && type !== 'fixed_amount') || !(amount > 0))
|
|
78
|
+
return null;
|
|
79
|
+
return { type, amount };
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Min–max pickup offer across the listed branches, for the pickup tab badge; null when none has one.
|
|
83
|
+
* Branches the picker hides are left out so the tab never advertises an offer the shopper can't pick.
|
|
84
|
+
* A percentage and a fixed amount can't share one range, so percentages win when both are set.
|
|
85
|
+
*/
|
|
86
|
+
export const getBranchDiscountRange = (branches) => {
|
|
87
|
+
const discounts = branches.filter(isBranchVisible).map(getBranchDiscount).filter((d) => !!d);
|
|
88
|
+
if (!discounts.length)
|
|
89
|
+
return null;
|
|
90
|
+
const type = discounts.some(d => d.type === 'percentage') ? 'percentage' : 'fixed_amount';
|
|
91
|
+
const amounts = discounts.filter(d => d.type === type).map(d => d.amount);
|
|
92
|
+
return { type, min: Math.min(...amounts), max: Math.max(...amounts) };
|
|
93
|
+
};
|
|
94
|
+
/** The storefront's working_hours and ready_at use 24h "HH:mm"; null for anything else. */
|
|
95
|
+
export const parseBranchTime = (time) => {
|
|
96
|
+
const match = String(time ?? '').trim().match(/^(\d{1,2}):(\d{2})(?::\d{2})?$/);
|
|
97
|
+
if (!match || Number(match[1]) > 24)
|
|
98
|
+
return null;
|
|
99
|
+
return { hours: Number(match[1]) % 24, minutes: Number(match[2]) };
|
|
100
|
+
};
|
|
101
|
+
/** Date#getDay() keys for the day names the storefront API may send (Arabic or English). */
|
|
102
|
+
const DAY_KEYS = {
|
|
103
|
+
sunday: 0, 'الاحد': 0,
|
|
104
|
+
monday: 1, 'الاثنين': 1,
|
|
105
|
+
tuesday: 2, 'الثلاثاء': 2,
|
|
106
|
+
wednesday: 3, 'الاربعاء': 3,
|
|
107
|
+
thursday: 4, 'الخميس': 4,
|
|
108
|
+
friday: 5, 'الجمعة': 5,
|
|
109
|
+
saturday: 6, 'السبت': 6,
|
|
110
|
+
};
|
|
111
|
+
const dayKeyFromName = (name) => DAY_KEYS[String(name ?? '').trim().toLowerCase().replace(/[أإآ]/g, 'ا')];
|
|
112
|
+
/**
|
|
113
|
+
* The storefront's `working_hours` (`{ name, times: [{ from, to }] }`, 24h times) as weekly
|
|
114
|
+
* schedule rows for the hours dropdown.
|
|
115
|
+
*/
|
|
116
|
+
export const getBranchWeekSchedule = (branch) => (branch.working_hours || [])
|
|
117
|
+
.filter(day => day?.name)
|
|
118
|
+
.map(day => ({
|
|
119
|
+
day_key: dayKeyFromName(day.name),
|
|
120
|
+
day: day.name,
|
|
121
|
+
times: (day.times || []).map(t => ({ start: t.from, end: t.to })),
|
|
122
|
+
}));
|
|
123
|
+
export const isBranchAlwaysOpen = (branch) => !!branch.always_open;
|
|
124
|
+
/**
|
|
125
|
+
* "11:00 م" / "11:00 PM". ar-SA's ICU pattern puts the day period first, which the bidi algorithm
|
|
126
|
+
* scrambles inside RTL text, so the parts are joined in a fixed "h:mm period" order instead.
|
|
127
|
+
*/
|
|
128
|
+
export const formatBranchClockTime = (time, locale) => {
|
|
129
|
+
const parsed = parseBranchTime(time);
|
|
130
|
+
if (!parsed)
|
|
131
|
+
return '';
|
|
132
|
+
const date = new Date(Date.UTC(2000, 0, 1, parsed.hours, parsed.minutes));
|
|
133
|
+
const parts = new Intl.DateTimeFormat(locale === 'ar' ? 'ar-SA-u-nu-latn' : 'en', {
|
|
134
|
+
timeZone: 'UTC',
|
|
135
|
+
hour: '2-digit',
|
|
136
|
+
minute: '2-digit',
|
|
137
|
+
hour12: true,
|
|
138
|
+
}).formatToParts(date);
|
|
139
|
+
const get = (type) => parts.find(p => p.type === type)?.value ?? '';
|
|
140
|
+
return `${get('hour')}:${get('minute')} ${get('dayPeriod')}`;
|
|
141
|
+
};
|
|
142
|
+
const sameTimes = (a, b) => a.length === b.length && a.every((t, i) => t.start === b[i].start && t.end === b[i].end);
|
|
143
|
+
/** Consecutive days with identical hours collapse into one row; the largest groups come first. */
|
|
144
|
+
export const groupBranchSchedule = (weekSchedule) => {
|
|
145
|
+
const groups = [];
|
|
146
|
+
const days = [...(weekSchedule || [])].filter(s => s.times?.length).sort((a, b) => (a.day_key ?? 0) - (b.day_key ?? 0));
|
|
147
|
+
for (const day of days) {
|
|
148
|
+
const last = groups[groups.length - 1];
|
|
149
|
+
if (last && day.day_key === last.lastDayKey + 1 && sameTimes(last.times, day.times)) {
|
|
150
|
+
last.days.push(day.day);
|
|
151
|
+
last.lastDayKey = day.day_key;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
groups.push({ days: [day.day], times: day.times, lastDayKey: day.day_key ?? 0 });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return groups.sort((a, b) => b.days.length - a.days.length).map(({ days, times }) => ({ days, times }));
|
|
158
|
+
};
|
|
159
|
+
/** Keeps the digits and a leading "+" the merchant typed; drops spaces, dashes and brackets. */
|
|
160
|
+
const cleanPhone = (value) => String(value ?? '').trim().replace(/[^\d+]/g, '');
|
|
161
|
+
export const getBranchPhoneHref = (branch) => {
|
|
162
|
+
const phone = cleanPhone(branch.contacts?.phone);
|
|
163
|
+
return phone ? `tel:${phone}` : null;
|
|
164
|
+
};
|
|
165
|
+
/** wa.me wants the international number as bare digits ("+966…" / "00966…" → "966…"). */
|
|
166
|
+
export const getBranchWhatsappHref = (branch) => {
|
|
167
|
+
const digits = cleanPhone(branch.contacts?.whatsapp).replace(/^\+/, '').replace(/^00/, '').replace(/\D/g, '');
|
|
168
|
+
return digits ? `https://wa.me/${digits}` : null;
|
|
169
|
+
};
|
|
170
|
+
export const getBranchDirectionsHref = (branch) => branch.location?.lat != null && branch.location?.lng != null
|
|
171
|
+
? `https://www.google.com/maps?q=${branch.location.lat},${branch.location.lng}`
|
|
172
|
+
: null;
|
|
173
|
+
/** Nearest selectable branch by distance; single pass O(n). */
|
|
35
174
|
export function findNearestBranch(branches, userLat, userLon) {
|
|
36
175
|
let nearest = null;
|
|
37
176
|
let minD = Number.POSITIVE_INFINITY;
|
|
38
177
|
for (const b of branches) {
|
|
39
178
|
const lat = b.location?.lat != null ? Number(b.location.lat) : Number.NaN;
|
|
40
179
|
const lng = b.location?.lng != null ? Number(b.location.lng) : Number.NaN;
|
|
180
|
+
// Closed branches that still take orders are selectable too, so gate on selectability, not is_open.
|
|
41
181
|
if (Number.isNaN(lat) || Number.isNaN(lng) || !isBranchSelectable(b))
|
|
42
182
|
continue;
|
|
43
183
|
const d = calculateDistance(userLat, userLon, lat, lng);
|
|
@@ -61,11 +201,12 @@ export function formatWorkingHoursDisplay(from, to, locale, untilLabel) {
|
|
|
61
201
|
const t = String(to).trim();
|
|
62
202
|
return !f || !t ? '' : f === '00:00' ? `${untilLabel} ${formatTimeTo12h(t, locale)}` : `${formatTimeTo12h(f, locale)} - ${formatTimeTo12h(t, locale)}`;
|
|
63
203
|
}
|
|
204
|
+
/** Matches the fields the branches API searches: branch, city and country names (either language). */
|
|
64
205
|
export const filterBranches = (branches, searchQuery) => {
|
|
65
206
|
if (!searchQuery)
|
|
66
207
|
return branches;
|
|
67
208
|
const q = searchQuery.toLowerCase();
|
|
68
|
-
return branches.filter((b) => b.name.
|
|
209
|
+
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)));
|
|
69
210
|
};
|
|
70
211
|
export const getIntentSubtitle = (intent, toAddress, fromBranch) => {
|
|
71
212
|
if (intent.type === 'branch') {
|
|
@@ -85,10 +226,30 @@ export const getIntentRegionId = (i) => idFrom(i?.address_details?.region?.id);
|
|
|
85
226
|
export const getIntentCityId = (i) => idFrom(i?.address_details?.city?.id);
|
|
86
227
|
export const getIntentDistrictId = (i) => idFrom(i?.address_details?.district?.id);
|
|
87
228
|
export const getIntentBranchId = (i) => i?.branch_details?.id;
|
|
88
|
-
/** Intent coordinates (branch tab only; address flow no longer uses coordinates). */
|
|
89
|
-
export const getIntentLatitude = (i) => i?.branch_details?.latitude;
|
|
90
|
-
export const getIntentLongitude = (i) => i?.branch_details?.longitude;
|
|
91
229
|
export const isMapOriginIntent = (i) => !!i && i.type === 'address' && i.address_details?.lat != null && i.address_details?.lng != null;
|
|
230
|
+
/** Parse a coordinate to a finite number, treating null and blank/whitespace strings as missing. */
|
|
231
|
+
export const toCoordinate = (value) => {
|
|
232
|
+
if (value == null || (typeof value === 'string' && value.trim() === ''))
|
|
233
|
+
return null;
|
|
234
|
+
const num = Number(value);
|
|
235
|
+
return Number.isFinite(num) ? num : null;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Address intent complete enough to order against: a national address code, or a district with a
|
|
239
|
+
* street or real coordinates. The district text may sit in `local` when the district object is empty.
|
|
240
|
+
*/
|
|
241
|
+
export const isIntentAddressComplete = (i) => {
|
|
242
|
+
if (!i || i.type !== 'address')
|
|
243
|
+
return false;
|
|
244
|
+
const d = i.address_details;
|
|
245
|
+
// Stored intents come from the API, so a field may not be a string.
|
|
246
|
+
const has = (value) => String(value ?? '').trim() !== '';
|
|
247
|
+
const lat = toCoordinate(d?.lat);
|
|
248
|
+
const lng = toCoordinate(d?.lng);
|
|
249
|
+
const hasCoordinates = lat != null && lng != null && !(lat === 0 && lng === 0);
|
|
250
|
+
const hasDistrict = has(d?.district?.name) || has(d?.local);
|
|
251
|
+
return has(d?.short_address) || (hasDistrict && (has(d?.street) || hasCoordinates));
|
|
252
|
+
};
|
|
92
253
|
export const hasSessionAddressIntent = (intent) => {
|
|
93
254
|
if (!intent || intent.type !== 'address' || intent.address_id)
|
|
94
255
|
return false;
|
|
@@ -120,13 +281,3 @@ export function buildAddressLocationPayloadFromSelection(options) {
|
|
|
120
281
|
...(shortAddress && { short_address: shortAddress }),
|
|
121
282
|
};
|
|
122
283
|
}
|
|
123
|
-
// Geolocation error codes - fallback constants for non-browser environments
|
|
124
|
-
const GEO_ERROR_PERMISSION_DENIED = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.PERMISSION_DENIED : 1;
|
|
125
|
-
const GEO_ERROR_POSITION_UNAVAILABLE = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.POSITION_UNAVAILABLE : 2;
|
|
126
|
-
const GEO_ERROR_TIMEOUT = typeof GeolocationPositionError !== 'undefined' ? GeolocationPositionError.TIMEOUT : 3;
|
|
127
|
-
const GEO_ERROR_MESSAGES = {
|
|
128
|
-
[GEO_ERROR_PERMISSION_DENIED]: 'Location permission denied',
|
|
129
|
-
[GEO_ERROR_POSITION_UNAVAILABLE]: 'Location unavailable',
|
|
130
|
-
[GEO_ERROR_TIMEOUT]: 'Location timeout',
|
|
131
|
-
};
|
|
132
|
-
export const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Inline icons shared with the checkout pickup picker (Checkout-Module INV-1414), kept byte-identical
|
|
6
|
+
* so both surfaces render the same glyphs.
|
|
7
|
+
*/
|
|
8
|
+
/** Checkout `LightningIcon.vue` — the "save delivery fees" pickup-tab badge. */
|
|
9
|
+
export const LightningIcon = `<svg width="7" height="10" viewBox="0 0 7 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.41015 0.036C5.73815 0.084 5.96415 0.222 6.08815 0.45C6.21215 0.678 6.21415 0.952 6.09415 1.272C6.03815 1.432 5.89415 1.72 5.66215 2.136L5.13415 3.108C5.03015 3.308 4.96215 3.44 4.93015 3.504C4.91415 3.544 4.90215 3.576 4.89415 3.6C4.89415 3.656 4.91815 3.7 4.96615 3.732C4.99015 3.74 5.02615 3.748 5.07415 3.756H5.51815C5.79815 3.756 5.99015 3.76 6.09415 3.768C6.30215 3.784 6.45815 3.832 6.56215 3.912C6.70615 4.008 6.81215 4.138 6.88015 4.302C6.94815 4.466 6.97015 4.636 6.94615 4.812C6.93015 4.948 6.85815 5.1 6.73015 5.268C6.66615 5.356 6.53815 5.508 6.34615 5.724L3.65815 8.82C3.35415 9.172 3.14815 9.398 3.04015 9.498C2.93215 9.598 2.83415 9.664 2.74615 9.696C2.58615 9.768 2.43415 9.766 2.29015 9.69C2.14615 9.614 2.05415 9.488 2.01415 9.312C1.99815 9.208 1.99615 9.08 2.00815 8.928C2.02015 8.776 2.07415 8.472 2.17015 8.016L2.50615 6.432C2.57815 6.104 2.61815 5.888 2.62615 5.784C2.63415 5.728 2.62215 5.686 2.59015 5.658C2.55815 5.63 2.52615 5.612 2.49415 5.604C2.39815 5.588 2.18615 5.58 1.85815 5.58H1.60615C1.19815 5.58 0.918154 5.568 0.766154 5.544C0.462154 5.504 0.246154 5.38 0.118154 5.172C-0.00984615 4.964 -0.0338462 4.704 0.0461538 4.392C0.0861538 4.24 0.190154 3.968 0.358154 3.576L1.25815 1.464C1.41015 1.112 1.51815 0.872 1.58215 0.744C1.71015 0.512 1.85815 0.34 2.02615 0.228C2.19415 0.116 2.40215 0.048 2.65015 0.024C2.79415 0.008 3.05415 0 3.43015 0H4.47415C4.93815 0 5.25015 0.012 5.41015 0.036Z" fill="white"/></svg>`;
|
|
10
|
+
/** Pickup-instructions line on the branch card (design-provided). */
|
|
11
|
+
export const NotesIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.58709 4.67775L11.769 5.52554M7.90501 7.20895L9.49598 7.63284M7.98415 11.9777L8.62054 12.1472C10.4205 12.6268 11.3205 12.8666 12.0295 12.4595C12.7385 12.0525 12.9797 11.1576 13.462 9.36777L14.1441 6.83657C14.6264 5.04674 14.8675 4.15183 14.4582 3.44681C14.0488 2.7418 13.1488 2.50201 11.3489 2.02242L10.7125 1.85287C8.91249 1.37328 8.0125 1.13349 7.30349 1.54053C6.59447 1.94757 6.35332 2.84249 5.87102 4.63231L5.18894 7.16351C4.70664 8.95334 4.46549 9.84825 4.87484 10.5533C5.28419 11.2583 6.18418 11.4981 7.98415 11.9777Z" stroke="#555555" stroke-width="1.125" stroke-linecap="round"/><path d="M8.00016 13.964L7.36527 14.1369C5.56952 14.6259 4.67164 14.8704 3.96429 14.4554C3.25694 14.0404 3.01636 13.1279 2.53519 11.303L1.85471 8.72211C1.37354 6.89717 1.13295 5.98471 1.54134 5.26586C1.89461 4.64404 2.66683 4.66668 3.66683 4.66661" stroke="#555555" stroke-width="1.125" stroke-linecap="round"/></svg>`;
|
|
12
|
+
/** Pickup-availability (preparation time) line on the branch card (design-provided). */
|
|
13
|
+
export const PickupAvailabilityIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="8.00016" cy="8.00004" r="6.66667" stroke="#555555" stroke-width="1.125"/><path d="M8 5.33337V8.00004L9.33333 9.33337" stroke="#555555" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
14
|
+
/** Working-hours (open/closed status) line on the branch card (design-provided). */
|
|
15
|
+
export const WorkingHoursIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.00014 14.6667C4.31824 14.6667 1.3335 11.6819 1.3335 8.00004C1.3335 4.31814 4.31826 1.33337 8.00016 1.33337C10.9853 1.33337 13.484 3.2953 14.3335 6.00004H12.6668" stroke="#666666" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 5.33337V8.00004L9.33333 9.33337" stroke="#666666" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.6367 8.66667C14.6565 8.44724 14.6667 8.22486 14.6667 8M10 14.6667C10.2277 14.5917 10.4502 14.5043 10.6667 14.4052M13.8604 11.3333C13.989 11.0856 14.1036 10.8288 14.2034 10.5641M12.1283 13.4862C12.358 13.2961 12.5754 13.0905 12.7792 12.871" stroke="#666666" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
16
|
+
/** Location (country, city, district) line on the branch card (design-provided). */
|
|
17
|
+
export const BranchLocationIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="8.00016" cy="4.66667" r="2.66667" stroke="#555555" stroke-width="1.125"/><path d="M8 7.33337L8 12" stroke="#555555" stroke-width="1.125" stroke-linecap="round"/><path d="M11.3332 12.6666C11.3332 13.403 9.84079 14 7.99984 14C6.15889 14 4.6665 13.403 4.6665 12.6666" stroke="#555555" stroke-width="1.125" stroke-linecap="round"/></svg>`;
|