@salla.sa/twilight-components 2.14.427 → 2.14.429
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/{filepond-CnPKR-6x.js → filepond--V9rRgVA.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-D0g6EUyA.js → filepond-plugin-file-poster-DzvswSJb.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DXUJ6UPq.js → filepond-plugin-file-validate-size-C5wUWXz6.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-NgEbyq_W.js → filepond-plugin-file-validate-type-HA2w2_fC.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DU4QWlEV.js → filepond-plugin-image-edit-CXrhd-IB.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-xYuPxwvc.js → filepond-plugin-image-exif-orientation-BJnamgw6.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CY_efZwj.js → filepond-plugin-image-preview-CmdkZJij.js} +1 -1
- package/dist/cjs/{functions-CTufnsoC.js → functions-DPnm948J.js} +1 -1
- package/dist/cjs/{index-BEj17I33.js → index-D3xsx646.js} +6 -6
- package/dist/cjs/{index-Z8F5J-RV.js → index-DRfjMaC1.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 +3 -3
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +17 -17
- package/dist/cjs/{salla-bullet-delivery.cjs.entry.js → salla-bullet-delivery_2.cjs.entry.js} +635 -140
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +2 -2
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +8 -8
- 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 +2 -2
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +43 -17
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +2 -2
- package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
- package/dist/cjs/salla-hook.cjs.entry.js +2 -2
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +2 -2
- package/dist/cjs/salla-localization-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +8 -8
- package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
- package/dist/cjs/salla-loyalty-reward.cjs.entry.js +4 -4
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +2 -2
- package/dist/cjs/salla-map.cjs.entry.js +4 -4
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +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.cjs.entry.js +2 -2
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- 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-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-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 +1 -1
- 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 +3 -3
- package/dist/cjs/salla-product-card_2.cjs.entry.js +6 -6
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-reward-action_4.cjs.entry.js +11 -11
- package/dist/cjs/salla-scopes.cjs.entry.js +2 -2
- package/dist/cjs/salla-search.cjs.entry.js +6 -6
- package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- 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-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
- 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 +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/{tracked-promise-C_10lCIK.js → tracked-promise-CFp5Besf.js} +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-D9nRSUSv.js → vanilla-picker-Jk2F9CAy.js} +1 -1
- package/dist/collection/collection-manifest.json +7 -0
- package/dist/collection/components/salla-bullet-delivery/api-service.js +80 -13
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.css +5 -0
- package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +344 -120
- package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +1 -1
- package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +1 -1
- package/dist/collection/components/salla-color-picker/salla-color-picker.js +1 -1
- package/dist/collection/components/salla-comment-form/salla-comment-form.js +1 -1
- package/dist/collection/components/salla-comments/salla-comment-item.js +3 -3
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +1 -1
- package/dist/collection/components/salla-count-down/salla-count-down.js +1 -1
- package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1 -1
- package/dist/collection/components/salla-delivery-promise/delivery-promise-api.js +4 -5
- package/dist/collection/components/salla-delivery-promise/salla-delivery-promise.js +40 -12
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +2 -2
- package/dist/collection/components/salla-filters/salla-filters.js +1 -1
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +2 -2
- package/dist/collection/components/salla-fulfillment-methods/salla-fulfillment-methods.js +1 -1
- package/dist/collection/components/salla-gifting/salla-gifting.js +2 -2
- package/dist/collection/components/salla-hook/salla-hook.js +1 -1
- package/dist/collection/components/salla-list-tile/salla-list-tile.js +1 -1
- package/dist/collection/components/salla-loading/salla-loading.js +1 -1
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +1 -1
- package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +1 -1
- package/dist/collection/components/salla-loyalty-program/salla-loyalty-hero.js +3 -3
- package/dist/collection/components/salla-loyalty-program/salla-loyalty-point.js +3 -3
- package/dist/collection/components/salla-loyalty-program/salla-loyalty-reward.js +2 -2
- package/dist/collection/components/salla-loyalty-program/salla-reward-action.js +1 -1
- package/dist/collection/components/salla-loyalty-program/salla-reward-card.js +1 -1
- package/dist/collection/components/salla-loyalty-program/salla-reward-details.js +3 -3
- package/dist/collection/components/salla-loyalty-program/salla-reward-exchange.js +3 -3
- package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js +1 -1
- package/dist/collection/components/salla-map/salla-map.js +3 -3
- 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-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-price-range/salla-price-range.js +2 -2
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
- package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
- package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
- package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
- package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
- package/dist/collection/components/salla-search/salla-search.js +5 -5
- package/dist/collection/components/salla-searchable-dropdown/interfaces.js +1 -0
- package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +566 -0
- 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-tooltip/salla-tooltip.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/salla-bullet-delivery.js +445 -148
- package/dist/components/salla-cart-coupons.js +1 -1
- package/dist/components/salla-cart-summary.js +1 -1
- package/dist/components/salla-color-picker2.js +1 -1
- package/dist/components/salla-comment-form2.js +1 -1
- package/dist/components/salla-comment-item2.js +3 -3
- package/dist/components/salla-conditional-fields2.js +1 -1
- package/dist/components/salla-count-down2.js +1 -1
- package/dist/components/salla-datetime-picker2.js +1 -1
- package/dist/components/salla-delivery-promise.js +42 -16
- package/dist/components/salla-file-upload2.js +2 -2
- package/dist/components/salla-filters-widget2.js +2 -2
- package/dist/components/salla-filters.js +1 -1
- package/dist/components/salla-fulfillment-methods.js +1 -1
- package/dist/components/salla-gifting.js +2 -2
- package/dist/components/salla-hook.js +1 -1
- package/dist/components/salla-list-tile2.js +1 -1
- package/dist/components/salla-loading2.js +1 -1
- package/dist/components/salla-localization-modal.js +1 -1
- package/dist/components/salla-loyalty-hero2.js +3 -3
- package/dist/components/salla-loyalty-point2.js +3 -3
- package/dist/components/salla-loyalty-prize-item.js +1 -1
- package/dist/components/salla-loyalty-reward.js +2 -2
- package/dist/components/salla-maintenance-alert.js +1 -1
- package/dist/components/salla-map2.js +3 -3
- 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-summary.js +1 -1
- package/dist/components/salla-payments.js +2 -2
- package/dist/components/salla-placeholder2.js +1 -1
- package/dist/components/salla-price-range2.js +2 -2
- package/dist/components/salla-product-availability2.js +1 -1
- package/dist/components/salla-product-card2.js +5 -5
- package/dist/components/salla-product-size-guide.js +2 -2
- package/dist/components/salla-quantity-input2.js +1 -1
- package/dist/components/salla-quick-buy2.js +1 -1
- package/dist/components/salla-review-card2.js +1 -1
- package/dist/components/salla-reviews-page.js +1 -1
- package/dist/components/salla-reviews.js +1 -1
- package/dist/components/salla-reward-action2.js +1 -1
- package/dist/components/salla-reward-card2.js +1 -1
- package/dist/components/salla-reward-details2.js +3 -3
- package/dist/components/salla-reward-exchange2.js +3 -3
- package/dist/components/salla-scopes.js +1 -1
- package/dist/components/salla-search.js +5 -5
- package/dist/components/salla-searchable-dropdown.d.ts +11 -0
- package/dist/components/salla-searchable-dropdown.js +9 -0
- package/dist/components/salla-searchable-dropdown2.js +255 -0
- package/dist/components/salla-skeleton2.js +1 -1
- package/dist/components/salla-social-share.js +1 -1
- 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-tooltip2.js +1 -1
- package/dist/components/salla-user-settings.js +1 -1
- package/dist/esm/{filepond-BRnZDx-B.js → filepond-fJKURtC4.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-D5fDjFO7.js → filepond-plugin-file-poster-Ll-3yUwR.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-CFvpeu0k.js → filepond-plugin-file-validate-size-2D44oWIJ.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-BhjoaDUg.js → filepond-plugin-file-validate-type-08Jawn6d.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-Cenn_Vlr.js → filepond-plugin-image-edit-DmEVMjMi.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-DC9TWqJo.js → filepond-plugin-image-exif-orientation-DJo_07yV.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-Bj9DJRFj.js → filepond-plugin-image-preview-Nd-PQAho.js} +1 -1
- package/dist/esm/{functions-DyAwfRCL.js → functions-GnOlk8am.js} +1 -1
- package/dist/esm/{index-COFXO9XT.js → index-Ba0YDJC7.js} +1 -1
- package/dist/esm/{index-2RfKl9ZG.js → index-DR8BHH7X.js} +6 -6
- 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 +3 -3
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +17 -17
- package/dist/esm/{salla-bullet-delivery.entry.js → salla-bullet-delivery_2.entry.js} +635 -141
- package/dist/esm/salla-cart-coupons.entry.js +2 -2
- package/dist/esm/salla-cart-item-offers_2.entry.js +2 -2
- package/dist/esm/salla-comment-form_8.entry.js +8 -8
- 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 +2 -2
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +43 -17
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +3 -3
- package/dist/esm/salla-filters.entry.js +2 -2
- package/dist/esm/salla-fulfillment-methods.entry.js +2 -2
- package/dist/esm/salla-gifting.entry.js +3 -3
- package/dist/esm/salla-hook.entry.js +2 -2
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +2 -2
- package/dist/esm/salla-localization-modal.entry.js +2 -2
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner.entry.js +2 -2
- package/dist/esm/salla-loyalty-hero_2.entry.js +8 -8
- package/dist/esm/salla-loyalty-panel.entry.js +3 -3
- package/dist/esm/salla-loyalty-prize-item.entry.js +2 -2
- package/dist/esm/salla-loyalty-program.entry.js +3 -3
- package/dist/esm/salla-loyalty-reward.entry.js +4 -4
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +2 -2
- package/dist/esm/salla-map.entry.js +4 -4
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +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.entry.js +2 -2
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +2 -2
- package/dist/esm/salla-offer.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-summary.entry.js +2 -2
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +3 -3
- package/dist/esm/salla-placeholder.entry.js +2 -2
- package/dist/esm/salla-price-range.entry.js +3 -3
- package/dist/esm/salla-product-card_2.entry.js +6 -6
- package/dist/esm/salla-product-size-guide.entry.js +3 -3
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-progress-bar.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-reward-action_4.entry.js +11 -11
- package/dist/esm/salla-scopes.entry.js +2 -2
- package/dist/esm/salla-search.entry.js +6 -6
- package/dist/esm/salla-skeleton.entry.js +2 -2
- package/dist/esm/salla-slider.entry.js +1 -1
- 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-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +2 -2
- 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 +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/{tracked-promise-DjHV13KA.js → tracked-promise-BTkBmrok.js} +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-BoRNi1fj.js → vanilla-picker-f4lmttLY.js} +1 -1
- package/dist/twilight/p-031f8d35.entry.js +4 -0
- package/dist/twilight/{p-ddb5f8e3.entry.js → p-08c6172b.entry.js} +1 -1
- package/dist/twilight/p-097e2ba0.entry.js +4 -0
- package/dist/twilight/p-0ccf332d.entry.js +4 -0
- package/dist/twilight/{p-3d7a49d9.entry.js → p-103dc47c.entry.js} +1 -1
- package/dist/twilight/{p-c4b74217.entry.js → p-1208793a.entry.js} +1 -1
- package/dist/twilight/{p-15258fe3.entry.js → p-154e782d.entry.js} +1 -1
- package/dist/twilight/{p-b64d9557.entry.js → p-19bb31a5.entry.js} +1 -1
- package/dist/twilight/{p-022144ee.entry.js → p-1c8726e2.entry.js} +1 -1
- package/dist/twilight/{p-adf96b4c.entry.js → p-1e7d16a3.entry.js} +1 -1
- package/dist/twilight/{p-b4273ea4.entry.js → p-2d705236.entry.js} +1 -1
- package/dist/twilight/{p-7106682a.entry.js → p-2e8588ca.entry.js} +1 -1
- package/dist/twilight/{p-fb1b997d.entry.js → p-30256e5f.entry.js} +1 -1
- package/dist/twilight/p-308cfcab.entry.js +4 -0
- package/dist/twilight/{p-f1859466.entry.js → p-38a8f05e.entry.js} +1 -1
- package/dist/twilight/{p-a4f96a76.entry.js → p-3910e00f.entry.js} +1 -1
- package/dist/twilight/{p-ece0e68f.entry.js → p-3a2fdd6f.entry.js} +1 -1
- package/dist/twilight/p-3cc1582f.entry.js +4 -0
- package/dist/twilight/p-3ec34eae.entry.js +4 -0
- package/dist/twilight/{p-916187fb.entry.js → p-400257fd.entry.js} +1 -1
- package/dist/twilight/{p-a72161e7.entry.js → p-42cc9b33.entry.js} +1 -1
- package/dist/twilight/{p-7f07d192.entry.js → p-4482e672.entry.js} +1 -1
- package/dist/twilight/{p-aac173b7.entry.js → p-44b289bb.entry.js} +1 -1
- package/dist/twilight/{p-d2b90374.entry.js → p-4da58baf.entry.js} +1 -1
- package/dist/twilight/{p-390e50ee.entry.js → p-4f873363.entry.js} +1 -1
- package/dist/twilight/{p-1cc094d9.entry.js → p-5999d681.entry.js} +1 -1
- package/dist/twilight/{p-a96ae5ac.entry.js → p-59f47a08.entry.js} +1 -1
- package/dist/twilight/{p-9d20db0f.entry.js → p-5c347cd5.entry.js} +1 -1
- package/dist/twilight/{p-184fbcdf.entry.js → p-5ebbec76.entry.js} +1 -1
- package/dist/twilight/{p-56070211.entry.js → p-5ecf2b26.entry.js} +1 -1
- package/dist/twilight/{p-ce0ecd6d.entry.js → p-612c5b08.entry.js} +1 -1
- package/dist/twilight/{p-3eb30788.entry.js → p-624503ee.entry.js} +1 -1
- package/dist/twilight/{p-597273c9.entry.js → p-6339390a.entry.js} +1 -1
- package/dist/twilight/p-64376e97.entry.js +4 -0
- package/dist/twilight/{p-b75f02c5.entry.js → p-65839961.entry.js} +1 -1
- package/dist/twilight/{p-416bfa3c.entry.js → p-6c58235e.entry.js} +1 -1
- package/dist/twilight/{p-f5b4faf1.entry.js → p-6e26c815.entry.js} +1 -1
- package/dist/twilight/p-6f3da0b7.entry.js +4 -0
- package/dist/twilight/{p-63b807d8.entry.js → p-72b1e6ed.entry.js} +1 -1
- package/dist/twilight/{p-d198466f.entry.js → p-745329af.entry.js} +1 -1
- package/dist/twilight/{p-68981b47.entry.js → p-74eb04ec.entry.js} +1 -1
- package/dist/twilight/{p-be9b05ed.entry.js → p-78ce73ba.entry.js} +1 -1
- package/dist/twilight/{p-a4ee0f48.entry.js → p-7edaa78b.entry.js} +1 -1
- package/dist/twilight/{p-6fa8dc48.entry.js → p-807db423.entry.js} +1 -1
- package/dist/twilight/{p-5f4491df.entry.js → p-824dd42e.entry.js} +1 -1
- package/dist/twilight/{p-15f7a80c.entry.js → p-835c43e6.entry.js} +1 -1
- package/dist/twilight/{p-fdd9c784.entry.js → p-83c1d4b2.entry.js} +1 -1
- package/dist/twilight/{p-82b0696f.entry.js → p-8709e981.entry.js} +1 -1
- package/dist/twilight/{p-31a1aa8c.entry.js → p-8bfca6eb.entry.js} +1 -1
- package/dist/twilight/{p-26659429.entry.js → p-8fad5c91.entry.js} +1 -1
- package/dist/twilight/{p-abb0fe8a.entry.js → p-96d644b8.entry.js} +1 -1
- package/dist/twilight/{p-c57f29fb.entry.js → p-99d0fd61.entry.js} +1 -1
- package/dist/twilight/{p-9c6c3383.entry.js → p-9bde5e3c.entry.js} +1 -1
- package/dist/twilight/{p-25d69769.entry.js → p-9f320350.entry.js} +1 -1
- package/dist/twilight/{p-BRZ-xY4O.js → p-Bc2RLvfZ.js} +1 -1
- package/dist/twilight/{p-DIgIfJIX.js → p-CdbTKQNp.js} +1 -1
- package/dist/twilight/{p-BQHT0o4-.js → p-CiAXtUPQ.js} +1 -1
- package/dist/twilight/{p-gzETizzN.js → p-CmDT48y4.js} +1 -1
- package/dist/twilight/{p-f2zyoe62.js → p-D0FlIX_Z.js} +1 -1
- package/dist/twilight/{p-2RfKl9ZG.js → p-DR8BHH7X.js} +1 -1
- package/dist/twilight/{p-NH4fFDqc.js → p-Dqb1Ri2Y.js} +1 -1
- package/dist/twilight/{p-hMPmvZ4N.js → p-Dtp3srRX.js} +1 -1
- package/dist/twilight/{p-BWhaHax9.js → p-NohMjDY2.js} +1 -1
- package/dist/twilight/{p-5517f377.entry.js → p-a9cbd414.entry.js} +1 -1
- package/dist/twilight/{p-f758d06b.entry.js → p-b20265f2.entry.js} +1 -1
- package/dist/twilight/{p-826b7e39.entry.js → p-b59b7153.entry.js} +1 -1
- package/dist/twilight/{p-cd392e48.entry.js → p-bc47e256.entry.js} +1 -1
- package/dist/twilight/{p-c395af37.entry.js → p-bc76d253.entry.js} +1 -1
- package/dist/twilight/{p-f6afdeea.entry.js → p-bcf201a8.entry.js} +1 -1
- package/dist/twilight/{p-4a41c81f.entry.js → p-beb17e29.entry.js} +1 -1
- package/dist/twilight/{p-5dbfbde6.entry.js → p-c00d4e23.entry.js} +1 -1
- package/dist/twilight/p-c137e672.entry.js +4 -0
- package/dist/twilight/{p-49a31434.entry.js → p-c47e85e9.entry.js} +1 -1
- package/dist/twilight/{p-9e20aea5.entry.js → p-c4960804.entry.js} +1 -1
- package/dist/twilight/{p-0c50e6d1.entry.js → p-c52aac33.entry.js} +1 -1
- package/dist/twilight/{p-58e57008.entry.js → p-c707f55b.entry.js} +1 -1
- package/dist/twilight/p-cb8a1223.entry.js +4 -0
- package/dist/twilight/{p-0f17896f.entry.js → p-ccfe690a.entry.js} +1 -1
- package/dist/twilight/{p-B-Ntbq8B.js → p-cvulr5dQ.js} +1 -1
- package/dist/twilight/{p-674370d9.entry.js → p-d01e76f4.entry.js} +1 -1
- package/dist/twilight/{p-ea3e4838.entry.js → p-d567481d.entry.js} +1 -1
- package/dist/twilight/{p-d0a034ad.entry.js → p-d617d844.entry.js} +1 -1
- package/dist/twilight/{p-b59ea7ea.entry.js → p-df173474.entry.js} +1 -1
- package/dist/twilight/{p-85f0187e.entry.js → p-e0244c37.entry.js} +1 -1
- package/dist/twilight/{p-3c82be41.entry.js → p-e0750731.entry.js} +1 -1
- package/dist/twilight/{p-a44b9668.entry.js → p-e0af89bc.entry.js} +1 -1
- package/dist/twilight/{p-f95df964.entry.js → p-ed6007e1.entry.js} +1 -1
- package/dist/twilight/{p-6591111e.entry.js → p-ed8951c5.entry.js} +1 -1
- package/dist/twilight/p-f245d317.entry.js +4 -0
- package/dist/twilight/{p-f2cb9377.entry.js → p-f2b204a4.entry.js} +1 -1
- package/dist/twilight/{p-8fc96e64.entry.js → p-f579e8ef.entry.js} +1 -1
- package/dist/twilight/{p-ffa981ec.entry.js → p-fca971a6.entry.js} +1 -1
- package/dist/twilight/{p-3aa1e961.entry.js → p-ff75f1c4.entry.js} +1 -1
- package/dist/twilight/{p-8Cy2-80S.js → p-hkzTCOEy.js} +1 -1
- package/dist/twilight/{p-Ctl2lOrt.js → p-kg7IhfAv.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-bullet-delivery/api-service.d.ts +6 -5
- package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +38 -6
- package/dist/types/components/salla-delivery-promise/delivery-promise-api.d.ts +1 -1
- package/dist/types/components/salla-delivery-promise/salla-delivery-promise.d.ts +2 -0
- package/dist/types/components/salla-searchable-dropdown/interfaces.d.ts +5 -0
- package/dist/types/components/salla-searchable-dropdown/salla-searchable-dropdown.d.ts +47 -0
- package/dist/types/components.d.ts +135 -0
- package/package.json +5 -5
- package/dist/twilight/p-5be4ae85.entry.js +0 -4
- package/dist/twilight/p-5c2dcdb0.entry.js +0 -4
- package/dist/twilight/p-637724e7.entry.js +0 -4
- package/dist/twilight/p-68f163aa.entry.js +0 -4
- package/dist/twilight/p-6bf87309.entry.js +0 -4
- package/dist/twilight/p-873eed59.entry.js +0 -4
- package/dist/twilight/p-879f08a4.entry.js +0 -4
- package/dist/twilight/p-ae6aabba.entry.js +0 -4
- package/dist/twilight/p-d0520b44.entry.js +0 -4
- package/dist/twilight/p-dd0be0da.entry.js +0 -4
- package/dist/twilight/p-ec899dc9.entry.js +0 -4
|
@@ -2,18 +2,25 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { h, Host, } from "@stencil/core";
|
|
5
|
-
import { bulletDeliveryAPI, isSaudiArabia } from "./api-service";
|
|
6
|
-
import {
|
|
5
|
+
import { bulletDeliveryAPI, isSaudiArabia, clearApiCache } from "./api-service";
|
|
6
|
+
import { buildAddressLocationPayloadFromSelection, filterBranches, findNearestBranch, formatWorkingHoursDisplay, getBranchFirstSlot, getGeolocationErrorMessage, getIntentBranchId, getIntentCityId, getIntentCountryCode, getIntentCountryId, getIntentDistrictId, getIntentLatitude, getIntentLongitude, getIntentRegionId, getIntentSubtitle, hasSessionAddressIntent, requireRegionAndDistrictForSA, } from "./helpers";
|
|
7
7
|
const BRANCH_SEARCH_DEBOUNCE_MS = 1000;
|
|
8
8
|
const GEOLOCATION_TIMEOUT = 10000;
|
|
9
|
-
import
|
|
10
|
-
import Search from "../../assets/svg/search.svg";
|
|
11
|
-
import Location from "../../assets/svg/location.svg";
|
|
9
|
+
import GetDirections from "../../assets/svg/get-directions.svg";
|
|
12
10
|
import GPS from "../../assets/svg/gps.svg";
|
|
13
|
-
import MiniMap from "../../assets/svg/mini-map.svg";
|
|
14
|
-
import ArrowRight from "../../assets/svg/keyboard_arrow_right.svg";
|
|
15
11
|
import ArrowLeft from "../../assets/svg/keyboard_arrow_left.svg";
|
|
16
|
-
import
|
|
12
|
+
import ArrowRight from "../../assets/svg/keyboard_arrow_right.svg";
|
|
13
|
+
import Location from "../../assets/svg/location.svg";
|
|
14
|
+
import MiniMap from "../../assets/svg/mini-map.svg";
|
|
15
|
+
import Search from "../../assets/svg/search.svg";
|
|
16
|
+
import Store from "../../assets/svg/store3.svg";
|
|
17
|
+
const DEBUG_KEY = 'salla-bullet-delivery-debug';
|
|
18
|
+
const OVERRIDE_IP_KEY = 'salla-bullet-delivery-override-ip';
|
|
19
|
+
function log(message, data) {
|
|
20
|
+
if (localStorage.getItem(DEBUG_KEY)) {
|
|
21
|
+
data !== undefined ? console.log(message, data) : console.log(message);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
/**
|
|
18
25
|
* @slot footer - The bottom section of the component for custom actions.
|
|
19
26
|
*/
|
|
@@ -24,6 +31,11 @@ export class SallaBulletDelivery {
|
|
|
24
31
|
this.pendingCartSubmitPromise = null;
|
|
25
32
|
this.cartSubmitConfirmationPending = false;
|
|
26
33
|
this.branchSearchDebounceTimer = null;
|
|
34
|
+
this.countrySearchTimer = null;
|
|
35
|
+
this.regionSearchTimer = null;
|
|
36
|
+
this.citySearchTimer = null;
|
|
37
|
+
this.districtSearchTimer = null;
|
|
38
|
+
this.citySearchCounter = 0;
|
|
27
39
|
this.componentReady = false;
|
|
28
40
|
this.pendingOpen = false;
|
|
29
41
|
this.tabChanging = false;
|
|
@@ -50,7 +62,6 @@ export class SallaBulletDelivery {
|
|
|
50
62
|
/** True after saved addresses have been loaded (lazy: only when address tab is shown). */
|
|
51
63
|
this.savedAddressesLoaded = false;
|
|
52
64
|
// Core state
|
|
53
|
-
this.loading = true;
|
|
54
65
|
this.activeTab = "address";
|
|
55
66
|
this.isLoggedIn = false;
|
|
56
67
|
this.viewMode = "main";
|
|
@@ -76,6 +87,7 @@ export class SallaBulletDelivery {
|
|
|
76
87
|
this.selectedBranch = null;
|
|
77
88
|
this.branchSearchQuery = "";
|
|
78
89
|
// Loading states
|
|
90
|
+
this.loadingCountries = false;
|
|
79
91
|
this.loadingCities = false;
|
|
80
92
|
this.loadingDistricts = false;
|
|
81
93
|
this.loadingBranches = false;
|
|
@@ -84,11 +96,95 @@ export class SallaBulletDelivery {
|
|
|
84
96
|
this.savingAddress = false;
|
|
85
97
|
this.loadingSavedAddresses = false;
|
|
86
98
|
this.showCartWillBeClearedBanner = false;
|
|
99
|
+
// Searchable dropdown state
|
|
100
|
+
this.countrySearchQuery = '';
|
|
101
|
+
this.regionSearchQuery = '';
|
|
102
|
+
this.citySearchQuery = '';
|
|
103
|
+
this.districtSearchQuery = '';
|
|
104
|
+
this.searchingCountries = false;
|
|
105
|
+
this.searchingRegions = false;
|
|
106
|
+
this.searchingCities = false;
|
|
107
|
+
this.searchingDistricts = false;
|
|
108
|
+
this.displayedCountries = [];
|
|
109
|
+
this.displayedRegions = [];
|
|
110
|
+
this.displayedCities = [];
|
|
111
|
+
this.displayedDistricts = [];
|
|
87
112
|
/** Shown when scopes/allocation returns 422 (address outside delivery coverage). Only on delivery tab. */
|
|
88
113
|
this.allocationOutOfCoverageMessage = null;
|
|
89
114
|
this.newAddressForm = {
|
|
90
115
|
...SallaBulletDelivery.INITIAL_ADDRESS_FORM,
|
|
91
116
|
};
|
|
117
|
+
this.handleCountrySearch = (query) => {
|
|
118
|
+
this.countrySearchQuery = query;
|
|
119
|
+
return;
|
|
120
|
+
};
|
|
121
|
+
this.handleRegionSearch = (query) => {
|
|
122
|
+
this.regionSearchQuery = query;
|
|
123
|
+
return;
|
|
124
|
+
};
|
|
125
|
+
this.handleCitySearch = (query) => {
|
|
126
|
+
this.citySearchQuery = query;
|
|
127
|
+
if (this.citySearchTimer)
|
|
128
|
+
clearTimeout(this.citySearchTimer);
|
|
129
|
+
if (!query.trim()) {
|
|
130
|
+
this.displayedCities = this.cities;
|
|
131
|
+
this.searchingCities = false;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (query.trim().length < SallaBulletDelivery.DROPDOWN_SEARCH_MIN_CHARS)
|
|
135
|
+
return;
|
|
136
|
+
const requestId = ++this.citySearchCounter;
|
|
137
|
+
this.citySearchTimer = setTimeout(async () => {
|
|
138
|
+
this.searchingCities = true;
|
|
139
|
+
try {
|
|
140
|
+
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
141
|
+
const regionId = isSA ? this.selectedRegion?.id : undefined;
|
|
142
|
+
const results = await bulletDeliveryAPI.getCities(this.selectedCountry?.id, regionId, query);
|
|
143
|
+
if (requestId === this.citySearchCounter) {
|
|
144
|
+
this.displayedCities = results;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
if (requestId === this.citySearchCounter) {
|
|
149
|
+
this.displayedCities = this.cities;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
if (requestId === this.citySearchCounter) {
|
|
154
|
+
this.searchingCities = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, SallaBulletDelivery.DROPDOWN_SEARCH_DEBOUNCE_MS);
|
|
158
|
+
};
|
|
159
|
+
this.handleDistrictSearch = (query) => {
|
|
160
|
+
this.districtSearchQuery = query;
|
|
161
|
+
return;
|
|
162
|
+
};
|
|
163
|
+
this.handleCountryDropdownClosed = () => {
|
|
164
|
+
this.countrySearchQuery = '';
|
|
165
|
+
this.displayedCountries = this.countries;
|
|
166
|
+
this.searchingCountries = false;
|
|
167
|
+
};
|
|
168
|
+
this.handleRegionDropdownClosed = () => {
|
|
169
|
+
this.regionSearchQuery = '';
|
|
170
|
+
this.displayedRegions = this.regions;
|
|
171
|
+
this.searchingRegions = false;
|
|
172
|
+
};
|
|
173
|
+
this.handleCityDropdownClosed = () => {
|
|
174
|
+
this.citySearchQuery = '';
|
|
175
|
+
if (this.citySearchTimer) {
|
|
176
|
+
clearTimeout(this.citySearchTimer);
|
|
177
|
+
this.citySearchTimer = null;
|
|
178
|
+
}
|
|
179
|
+
++this.citySearchCounter;
|
|
180
|
+
this.displayedCities = this.cities;
|
|
181
|
+
this.searchingCities = false;
|
|
182
|
+
};
|
|
183
|
+
this.handleDistrictDropdownClosed = () => {
|
|
184
|
+
this.districtSearchQuery = '';
|
|
185
|
+
this.displayedDistricts = this.districts;
|
|
186
|
+
this.searchingDistricts = false;
|
|
187
|
+
};
|
|
92
188
|
/**
|
|
93
189
|
* Submit add-address form: create address via API then switch back to list.
|
|
94
190
|
*/
|
|
@@ -127,10 +223,61 @@ export class SallaBulletDelivery {
|
|
|
127
223
|
this.savingAddress = false;
|
|
128
224
|
}
|
|
129
225
|
};
|
|
226
|
+
this.handleCountrySelected = (item) => {
|
|
227
|
+
const country = this.countries.find(c => String(c.id) === String(item.id)) || item;
|
|
228
|
+
const isCountrySwitch = this.selectedCountry &&
|
|
229
|
+
country &&
|
|
230
|
+
this.selectedCountry.code !== country.code;
|
|
231
|
+
this.showCartWillBeClearedBanner = !!isCountrySwitch;
|
|
232
|
+
this.countrySearchQuery = '';
|
|
233
|
+
this.displayedCountries = this.countries;
|
|
234
|
+
this.applyCountryChange(country || null);
|
|
235
|
+
};
|
|
236
|
+
this.handleRegionSelected = (item) => {
|
|
237
|
+
const region = this.regions.find(r => String(r.id) === String(item.id)) || item;
|
|
238
|
+
this.selectedRegion = region || null;
|
|
239
|
+
this.regionSearchQuery = '';
|
|
240
|
+
this.displayedRegions = this.regions;
|
|
241
|
+
this.updateNewAddressForm({
|
|
242
|
+
region_id: region?.id,
|
|
243
|
+
city_id: undefined,
|
|
244
|
+
district_id: undefined,
|
|
245
|
+
city: undefined,
|
|
246
|
+
district: undefined,
|
|
247
|
+
});
|
|
248
|
+
if (region && this.selectedCountry) {
|
|
249
|
+
this.loadCities(this.selectedCountry.id, region.id);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
this.handleCitySelected = (item) => {
|
|
253
|
+
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
254
|
+
const city = this.cities.find(c => String(c.id) === String(item.id)) || item;
|
|
255
|
+
this.selectedCity = city || null;
|
|
256
|
+
this.selectedDistrict = null;
|
|
257
|
+
this.districtName = "";
|
|
258
|
+
this.citySearchQuery = '';
|
|
259
|
+
this.displayedCities = this.cities;
|
|
260
|
+
if (city) {
|
|
261
|
+
this.updateNewAddressForm({ city: city, district: undefined });
|
|
262
|
+
if (isSA) {
|
|
263
|
+
this.loadDistricts(city.id);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
this.handleDistrictSelected = (item) => {
|
|
268
|
+
const district = this.districts.find(d => String(d.id) === String(item.id)) || item;
|
|
269
|
+
this.selectedDistrict = district || null;
|
|
270
|
+
this.districtName = "";
|
|
271
|
+
this.districtSearchQuery = '';
|
|
272
|
+
this.displayedDistricts = this.districts;
|
|
273
|
+
if (district) {
|
|
274
|
+
this.updateNewAddressForm({ district });
|
|
275
|
+
}
|
|
276
|
+
};
|
|
130
277
|
}
|
|
131
|
-
/** Whether to show delivery + pickup tabs. From store.
|
|
278
|
+
/** Whether to show delivery + pickup tabs. From store.shipping.support_pickup */
|
|
132
279
|
get supportsPickup() {
|
|
133
|
-
return
|
|
280
|
+
return Boolean(Salla.config.get("store.shipping.support_pickup"));
|
|
134
281
|
}
|
|
135
282
|
/** The modal opening strategy: 'first_visit' | 'on_cart_click' | 'after_add_to_cart' */
|
|
136
283
|
get openingType() {
|
|
@@ -149,10 +296,9 @@ export class SallaBulletDelivery {
|
|
|
149
296
|
this.pendingOpen = true;
|
|
150
297
|
return;
|
|
151
298
|
}
|
|
152
|
-
// Reset state
|
|
299
|
+
// Reset state before opening
|
|
153
300
|
this.resetState();
|
|
154
|
-
|
|
155
|
-
// Open modal immediately to show skeleton/loading state
|
|
301
|
+
// Open modal immediately — fields render right away with inline loading
|
|
156
302
|
this.modal.open();
|
|
157
303
|
Salla.event.dispatch("salla::bullet-delivery.modal.opened");
|
|
158
304
|
try {
|
|
@@ -173,11 +319,16 @@ export class SallaBulletDelivery {
|
|
|
173
319
|
this.activeTab = "address";
|
|
174
320
|
}
|
|
175
321
|
// Load countries always; load saved addresses only when address tab is active (lazy tab data).
|
|
322
|
+
if (this.isLoggedIn && this.activeTab === "address") {
|
|
323
|
+
this.loadingSavedAddresses = true;
|
|
324
|
+
}
|
|
176
325
|
await Promise.all([
|
|
177
326
|
this.loadCountries(hasStoredAddressIds),
|
|
178
327
|
this.isLoggedIn && this.activeTab === "address"
|
|
179
328
|
? this.loadSavedAddresses().then(() => {
|
|
180
329
|
this.savedAddressesLoaded = true;
|
|
330
|
+
}).finally(() => {
|
|
331
|
+
this.loadingSavedAddresses = false;
|
|
181
332
|
})
|
|
182
333
|
: Promise.resolve(),
|
|
183
334
|
]);
|
|
@@ -215,9 +366,6 @@ export class SallaBulletDelivery {
|
|
|
215
366
|
console.error("SallaBulletDelivery: Error loading data", e);
|
|
216
367
|
}
|
|
217
368
|
finally {
|
|
218
|
-
// Only hide loading after all data is loaded and UI is ready
|
|
219
|
-
this.loading = false;
|
|
220
|
-
this.modal?.stopLoading();
|
|
221
369
|
this.overrideScopeSwitchUI();
|
|
222
370
|
}
|
|
223
371
|
}
|
|
@@ -252,12 +400,13 @@ export class SallaBulletDelivery {
|
|
|
252
400
|
this.branches = [];
|
|
253
401
|
this.filteredBranches = [];
|
|
254
402
|
this.newAddressForm = { ...SallaBulletDelivery.INITIAL_ADDRESS_FORM };
|
|
255
|
-
// Reset new state variables
|
|
256
403
|
this.showCartWillBeClearedBanner = false;
|
|
257
404
|
this.allocationOutOfCoverageMessage = null;
|
|
258
405
|
this.locationError = "";
|
|
259
406
|
this.savedAddressesLoaded = false;
|
|
260
407
|
this.loadingSavedAddresses = false;
|
|
408
|
+
this.loadingCountries = false;
|
|
409
|
+
this.resetSearchState();
|
|
261
410
|
}
|
|
262
411
|
getIntentStorage() {
|
|
263
412
|
const rememberLastSession = Boolean(Salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"));
|
|
@@ -384,10 +533,14 @@ export class SallaBulletDelivery {
|
|
|
384
533
|
? bulletDeliveryAPI.getDistricts(Number(cityId))
|
|
385
534
|
: Promise.resolve([]),
|
|
386
535
|
]);
|
|
387
|
-
if (isSA)
|
|
536
|
+
if (isSA) {
|
|
388
537
|
this.regions = regions;
|
|
538
|
+
this.displayedRegions = this.regions;
|
|
539
|
+
}
|
|
389
540
|
this.cities = cities;
|
|
541
|
+
this.displayedCities = this.cities;
|
|
390
542
|
this.districts = districts;
|
|
543
|
+
this.displayedDistricts = this.districts;
|
|
391
544
|
this.loadingCities = false;
|
|
392
545
|
this.loadingRegions = false;
|
|
393
546
|
this.loadingDistricts = false;
|
|
@@ -430,41 +583,117 @@ export class SallaBulletDelivery {
|
|
|
430
583
|
const storage = this.getShownStorage();
|
|
431
584
|
storage.set(this.sessionShownKey, true);
|
|
432
585
|
}
|
|
586
|
+
getIPLocationConfig() {
|
|
587
|
+
const configPath = "store.shipping.delivery_location";
|
|
588
|
+
const ipAddress = {
|
|
589
|
+
countryId: Salla.config.get(`${configPath}.country_id`),
|
|
590
|
+
regionId: Salla.config.get(`${configPath}.region_id`),
|
|
591
|
+
cityId: Salla.config.get(`${configPath}.city_id`),
|
|
592
|
+
districtId: Salla.config.get(`${configPath}.district_id`),
|
|
593
|
+
};
|
|
594
|
+
return localStorage.getItem(OVERRIDE_IP_KEY) ?
|
|
595
|
+
JSON.parse(localStorage.getItem(OVERRIDE_IP_KEY)) : ipAddress;
|
|
596
|
+
}
|
|
433
597
|
async loadCountries(skipEagerSubFetch = false) {
|
|
598
|
+
this.loadingCountries = true;
|
|
434
599
|
const forBranch = this.activeTab === "branch";
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if (
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
600
|
+
try {
|
|
601
|
+
this.countries = await bulletDeliveryAPI.getCountries(forBranch);
|
|
602
|
+
this.displayedCountries = this.countries;
|
|
603
|
+
const { countryId: configCountryId, regionId: configRegionId, cityId: configCityId, districtId: configDistrictId } = this.getIPLocationConfig();
|
|
604
|
+
log("getIPLocationConfig", this.getIPLocationConfig());
|
|
605
|
+
const countryToSelect = configCountryId && this.countries.length > 0
|
|
606
|
+
? this.countries.find((c) => String(c.id) === String(configCountryId))
|
|
607
|
+
: null;
|
|
608
|
+
if (countryToSelect) {
|
|
609
|
+
this.selectedCountry = countryToSelect;
|
|
610
|
+
this.updateNewAddressForm({
|
|
611
|
+
country_id: Number(this.selectedCountry.id),
|
|
612
|
+
});
|
|
613
|
+
// Skip eager sub-fetches when stored intent IDs exist — prefillFromSessionStorage
|
|
614
|
+
// will fire regions/cities/districts in parallel using the stored IDs directly.
|
|
615
|
+
if (!skipEagerSubFetch) {
|
|
616
|
+
const hasIPLocationIds = configRegionId != null ||
|
|
617
|
+
configCityId != null ||
|
|
618
|
+
configDistrictId != null;
|
|
619
|
+
if (hasIPLocationIds) {
|
|
620
|
+
await this.prefillFromIPLocation(countryToSelect, {
|
|
621
|
+
regionId: configRegionId,
|
|
622
|
+
cityId: configCityId,
|
|
623
|
+
districtId: configDistrictId,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
else if (isSaudiArabia(this.selectedCountry.code)) {
|
|
627
|
+
await this.loadRegions(this.selectedCountry.id);
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
await this.loadCities(this.selectedCountry.id);
|
|
631
|
+
}
|
|
455
632
|
}
|
|
456
633
|
}
|
|
457
634
|
}
|
|
635
|
+
finally {
|
|
636
|
+
this.loadingCountries = false;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
async prefillFromIPLocation(country, ids) {
|
|
640
|
+
const isSA = isSaudiArabia(country.code);
|
|
641
|
+
const { regionId, cityId, districtId } = ids;
|
|
642
|
+
const [regions, cities, districts] = await Promise.all([
|
|
643
|
+
isSA ? bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
|
|
644
|
+
bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
|
|
645
|
+
cityId != null
|
|
646
|
+
? bulletDeliveryAPI.getDistricts(Number(cityId))
|
|
647
|
+
: Promise.resolve([]),
|
|
648
|
+
]);
|
|
649
|
+
if (isSA) {
|
|
650
|
+
this.regions = regions;
|
|
651
|
+
this.displayedRegions = this.regions;
|
|
652
|
+
}
|
|
653
|
+
this.cities = cities;
|
|
654
|
+
this.displayedCities = this.cities;
|
|
655
|
+
this.districts = districts;
|
|
656
|
+
this.displayedDistricts = this.districts;
|
|
657
|
+
this.loadingRegions = false;
|
|
658
|
+
this.loadingCities = false;
|
|
659
|
+
this.loadingDistricts = false;
|
|
660
|
+
if (isSA && regionId != null) {
|
|
661
|
+
const region = this.regions.find((r) => String(r.id) === String(regionId));
|
|
662
|
+
if (region) {
|
|
663
|
+
this.selectedRegion = region;
|
|
664
|
+
this.updateNewAddressForm({ region_id: region.id });
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (cityId != null && this.cities.length > 0) {
|
|
668
|
+
const city = this.cities.find((c) => String(c.id) === String(cityId));
|
|
669
|
+
if (city) {
|
|
670
|
+
this.selectedCity = city;
|
|
671
|
+
this.updateNewAddressForm({ city_id: city.id, city });
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (districtId != null && this.districts.length > 0) {
|
|
675
|
+
const district = this.findPrefillDistrict(districtId);
|
|
676
|
+
if (district) {
|
|
677
|
+
this.selectedDistrict = district;
|
|
678
|
+
this.updateNewAddressForm({
|
|
679
|
+
district_id: district.id,
|
|
680
|
+
district,
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
458
684
|
}
|
|
459
685
|
async loadCities(countryId, regionId) {
|
|
460
686
|
this.loadingCities = true;
|
|
461
687
|
this.cities = [];
|
|
688
|
+
this.displayedCities = [];
|
|
462
689
|
this.districts = [];
|
|
690
|
+
this.displayedDistricts = [];
|
|
463
691
|
this.selectedCity = null;
|
|
464
692
|
this.selectedDistrict = null;
|
|
465
693
|
this.districtName = "";
|
|
466
694
|
try {
|
|
467
695
|
this.cities = await bulletDeliveryAPI.getCities(countryId, regionId);
|
|
696
|
+
this.displayedCities = this.cities;
|
|
468
697
|
}
|
|
469
698
|
finally {
|
|
470
699
|
this.loadingCities = false;
|
|
@@ -473,10 +702,12 @@ export class SallaBulletDelivery {
|
|
|
473
702
|
async loadDistricts(cityId) {
|
|
474
703
|
this.loadingDistricts = true;
|
|
475
704
|
this.districts = [];
|
|
705
|
+
this.displayedDistricts = [];
|
|
476
706
|
this.selectedDistrict = null;
|
|
477
707
|
this.districtName = "";
|
|
478
708
|
try {
|
|
479
709
|
this.districts = await bulletDeliveryAPI.getDistricts(cityId);
|
|
710
|
+
this.displayedDistricts = this.districts;
|
|
480
711
|
}
|
|
481
712
|
finally {
|
|
482
713
|
this.loadingDistricts = false;
|
|
@@ -557,7 +788,6 @@ export class SallaBulletDelivery {
|
|
|
557
788
|
}
|
|
558
789
|
async loadSavedAddresses() {
|
|
559
790
|
this.savedAddresses = await bulletDeliveryAPI.getSavedAddresses();
|
|
560
|
-
// If session address exists (guest intent before login), select it by default
|
|
561
791
|
const intent = this.getStoredIntent();
|
|
562
792
|
const hasSessionAddress = hasSessionAddressIntent(intent);
|
|
563
793
|
if (hasSessionAddress) {
|
|
@@ -565,13 +795,11 @@ export class SallaBulletDelivery {
|
|
|
565
795
|
this.selectedSavedAddress = null;
|
|
566
796
|
}
|
|
567
797
|
else {
|
|
568
|
-
// Select default address if available and valid
|
|
569
798
|
const defaultAddress = this.savedAddresses.find((a) => a.is_default && a.is_in_coverage !== false);
|
|
570
799
|
if (defaultAddress) {
|
|
571
800
|
this.selectedSavedAddress = defaultAddress;
|
|
572
801
|
}
|
|
573
802
|
else {
|
|
574
|
-
// Select first valid address
|
|
575
803
|
const validAddress = this.savedAddresses.find((a) => a.is_in_coverage !== false);
|
|
576
804
|
if (validAddress) {
|
|
577
805
|
this.selectedSavedAddress = validAddress;
|
|
@@ -583,12 +811,22 @@ export class SallaBulletDelivery {
|
|
|
583
811
|
this.selectedCountry = newCountry;
|
|
584
812
|
this.selectedRegion = null;
|
|
585
813
|
this.regions = [];
|
|
814
|
+
this.displayedRegions = [];
|
|
586
815
|
this.cities = [];
|
|
816
|
+
this.displayedCities = [];
|
|
587
817
|
this.districts = [];
|
|
818
|
+
this.displayedDistricts = [];
|
|
588
819
|
this.selectedCity = null;
|
|
589
820
|
this.selectedDistrict = null;
|
|
590
821
|
this.districtName = "";
|
|
591
822
|
this.allocationOutOfCoverageMessage = null;
|
|
823
|
+
this.regionSearchQuery = '';
|
|
824
|
+
this.citySearchQuery = '';
|
|
825
|
+
this.districtSearchQuery = '';
|
|
826
|
+
this.searchingRegions = false;
|
|
827
|
+
this.searchingCities = false;
|
|
828
|
+
this.searchingDistricts = false;
|
|
829
|
+
this.clearSearchTimers();
|
|
592
830
|
if (this.selectedCountry) {
|
|
593
831
|
this.updateNewAddressForm({
|
|
594
832
|
country_id: Number(this.selectedCountry.id),
|
|
@@ -612,14 +850,18 @@ export class SallaBulletDelivery {
|
|
|
612
850
|
async loadRegions(countryId) {
|
|
613
851
|
this.loadingRegions = true;
|
|
614
852
|
this.regions = [];
|
|
853
|
+
this.displayedRegions = [];
|
|
615
854
|
this.selectedRegion = null;
|
|
616
855
|
this.cities = [];
|
|
856
|
+
this.displayedCities = [];
|
|
617
857
|
this.districts = [];
|
|
858
|
+
this.displayedDistricts = [];
|
|
618
859
|
this.selectedCity = null;
|
|
619
860
|
this.selectedDistrict = null;
|
|
620
861
|
this.districtName = "";
|
|
621
862
|
try {
|
|
622
863
|
this.regions = await bulletDeliveryAPI.getRegions(countryId);
|
|
864
|
+
this.displayedRegions = this.regions;
|
|
623
865
|
}
|
|
624
866
|
finally {
|
|
625
867
|
this.loadingRegions = false;
|
|
@@ -696,6 +938,29 @@ export class SallaBulletDelivery {
|
|
|
696
938
|
}
|
|
697
939
|
}, BRANCH_SEARCH_DEBOUNCE_MS);
|
|
698
940
|
}
|
|
941
|
+
clearSearchTimers() {
|
|
942
|
+
[this.countrySearchTimer, this.regionSearchTimer, this.citySearchTimer, this.districtSearchTimer]
|
|
943
|
+
.forEach(t => {
|
|
944
|
+
if (t)
|
|
945
|
+
clearTimeout(t);
|
|
946
|
+
});
|
|
947
|
+
this.countrySearchTimer = this.regionSearchTimer = this.citySearchTimer = this.districtSearchTimer = null;
|
|
948
|
+
}
|
|
949
|
+
resetSearchState() {
|
|
950
|
+
this.countrySearchQuery = '';
|
|
951
|
+
this.regionSearchQuery = '';
|
|
952
|
+
this.citySearchQuery = '';
|
|
953
|
+
this.districtSearchQuery = '';
|
|
954
|
+
this.searchingCountries = false;
|
|
955
|
+
this.searchingRegions = false;
|
|
956
|
+
this.searchingCities = false;
|
|
957
|
+
this.searchingDistricts = false;
|
|
958
|
+
this.displayedCountries = [];
|
|
959
|
+
this.displayedRegions = [];
|
|
960
|
+
this.displayedCities = [];
|
|
961
|
+
this.displayedDistricts = [];
|
|
962
|
+
this.clearSearchTimers();
|
|
963
|
+
}
|
|
699
964
|
async loadBranchesWithLocation(lat, lng) {
|
|
700
965
|
this.loadingBranches = true;
|
|
701
966
|
try {
|
|
@@ -820,14 +1085,26 @@ export class SallaBulletDelivery {
|
|
|
820
1085
|
this.activeTab = tab;
|
|
821
1086
|
this.showCartWillBeClearedBanner = false;
|
|
822
1087
|
this.allocationOutOfCoverageMessage = null;
|
|
823
|
-
|
|
1088
|
+
this.resetSearchState();
|
|
824
1089
|
const forBranch = tab === "branch";
|
|
825
1090
|
this.countries = await bulletDeliveryAPI.getCountries(forBranch);
|
|
1091
|
+
this.displayedCountries = this.countries;
|
|
826
1092
|
const previousCountryId = this.selectedCountry?.id;
|
|
827
1093
|
if (previousCountryId !== undefined && previousCountryId !== null) {
|
|
828
1094
|
this.selectedCountry =
|
|
829
1095
|
this.countries.find((c) => c.id === previousCountryId) || null;
|
|
830
1096
|
}
|
|
1097
|
+
// Fallback to IP-detected country when carry-over fails
|
|
1098
|
+
if (!this.selectedCountry) {
|
|
1099
|
+
const { countryId: configCountryId } = this.getIPLocationConfig();
|
|
1100
|
+
if (configCountryId && this.countries.length > 0) {
|
|
1101
|
+
this.selectedCountry =
|
|
1102
|
+
this.countries.find((c) => String(c.id) === String(configCountryId)) || null;
|
|
1103
|
+
}
|
|
1104
|
+
if (!this.selectedCountry && this.countries.length === 1) {
|
|
1105
|
+
this.selectedCountry = this.countries[0];
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
831
1108
|
// Load appropriate data when switching tabs if country is selected
|
|
832
1109
|
if (this.selectedCountry) {
|
|
833
1110
|
if (tab === "branch") {
|
|
@@ -1077,7 +1354,6 @@ export class SallaBulletDelivery {
|
|
|
1077
1354
|
(this.activeTab === "address"
|
|
1078
1355
|
? Salla.lang.get("pages.checkout.address_out_of_coverage")
|
|
1079
1356
|
: Salla.lang.get("pages.checkout.failed_to_set_pickup"));
|
|
1080
|
-
Salla.notify?.error(errorMessage);
|
|
1081
1357
|
this.allocationOutOfCoverageMessage = errorMessage;
|
|
1082
1358
|
this.confirmBtn?.stop();
|
|
1083
1359
|
this.confirming = false;
|
|
@@ -1122,6 +1398,7 @@ export class SallaBulletDelivery {
|
|
|
1122
1398
|
this.setStoredIntent(result);
|
|
1123
1399
|
if (allocatedScopeId) {
|
|
1124
1400
|
await bulletDeliveryAPI.setDeliveryScope(allocatedScopeId);
|
|
1401
|
+
clearApiCache();
|
|
1125
1402
|
}
|
|
1126
1403
|
const allocationConfirmedPayload = {
|
|
1127
1404
|
...result,
|
|
@@ -1224,12 +1501,6 @@ export class SallaBulletDelivery {
|
|
|
1224
1501
|
wrapper.append(info, btn);
|
|
1225
1502
|
return wrapper;
|
|
1226
1503
|
}
|
|
1227
|
-
renderSkeleton() {
|
|
1228
|
-
return (h("div", { slot: "loading", class: "s-bullet-delivery-skeleton" }, h("div", { class: "s-bullet-delivery-skeleton-header" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-title", height: "28px", width: "68%" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-subtitle", height: "18px", width: "84%" })), h("div", { class: {
|
|
1229
|
-
"s-bullet-delivery-skeleton-tabs": true,
|
|
1230
|
-
"s-bullet-delivery-skeleton-tabs--single": !this.supportsPickup,
|
|
1231
|
-
} }, h("div", { class: "s-bullet-delivery-skeleton-tab" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-icon", height: "32px", width: "32px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-label", height: "18px", width: "92px" })), this.supportsPickup && (h("div", { class: "s-bullet-delivery-skeleton-tab" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-icon", height: "32px", width: "32px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-tab-label", height: "18px", width: "84px" })))), h("div", { class: "s-bullet-delivery-skeleton-content" }, h("div", { class: "s-bullet-delivery-skeleton-field" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-label", height: "16px", width: "96px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-control", height: "56px", width: "100%" })), h("div", { class: "s-bullet-delivery-skeleton-field" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-label", height: "16px", width: "104px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-control", height: "56px", width: "100%" })), h("div", { class: "s-bullet-delivery-skeleton-field" }, h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-label", height: "16px", width: "88px" }), h("salla-skeleton", { class: "s-bullet-delivery-skeleton-field-control", height: "56px", width: "100%" }))), h("div", { class: "s-bullet-delivery-skeleton-footer" }, h("salla-skeleton", { height: "52px", width: "100%" }))));
|
|
1232
|
-
}
|
|
1233
1504
|
renderTabs() {
|
|
1234
1505
|
// Show tabs only when pickup is supported; otherwise delivery-only view with no tabs
|
|
1235
1506
|
if (!this.supportsPickup)
|
|
@@ -1251,56 +1522,22 @@ export class SallaBulletDelivery {
|
|
|
1251
1522
|
return this.renderAlert(message);
|
|
1252
1523
|
}
|
|
1253
1524
|
renderCountrySelect() {
|
|
1254
|
-
return (h("div", { class: "s-bullet-delivery-field" }, h("
|
|
1255
|
-
const select = e.target;
|
|
1256
|
-
const countryId = Number.parseInt(select.value);
|
|
1257
|
-
const country = this.countries.find((c) => c.id === countryId);
|
|
1258
|
-
// A "switch" means the user already had a country and picked a different one
|
|
1259
|
-
const isCountrySwitch = this.selectedCountry &&
|
|
1260
|
-
country &&
|
|
1261
|
-
this.selectedCountry.code !== country.code;
|
|
1262
|
-
// Show the info banner whenever a country is changed to a different one
|
|
1263
|
-
this.showCartWillBeClearedBanner = !!isCountrySwitch;
|
|
1264
|
-
this.applyCountryChange(country || null);
|
|
1265
|
-
} }, h("option", { value: "", disabled: true, selected: !this.selectedCountry }, Salla.lang.get("pages.checkout.select_country")), this.countries.map((country) => (h("option", { key: country.id, value: country.id, selected: this.selectedCountry?.id === country.id }, country.name))))));
|
|
1266
|
-
}
|
|
1267
|
-
renderSelectLoader() {
|
|
1268
|
-
return (h("span", { class: "s-bullet-delivery-select-loader", "aria-hidden": "true" }, h("salla-skeleton", { height: "16px", width: "16px" })));
|
|
1269
|
-
}
|
|
1270
|
-
renderLoadingLabel(label, htmlFor, isLoading = false, isRequired = true) {
|
|
1271
|
-
return (h("label", { class: "s-bullet-delivery-label", htmlFor: htmlFor }, h("span", { class: "s-bullet-delivery-label-content" }, h("span", null, label, isRequired && h("span", { class: "text-red-500" }, " *")), isLoading && this.renderSelectLoader())));
|
|
1525
|
+
return (h("div", { class: "s-bullet-delivery-field" }, h("salla-searchable-dropdown", { label: Salla.lang.get("blocks.buy_as_gift.receiver_country"), placeholder: Salla.lang.get("pages.checkout.select_country"), items: this.displayedCountries, selectedItem: this.selectedCountry, loading: this.loadingCountries, searching: this.searchingCountries, disabled: this.countries.length <= 1, required: true, inputId: "bullet-delivery-country", searchQuery: this.countrySearchQuery, clientSearch: true, onItemSelected: (e) => this.handleCountrySelected(e.detail), onSearchInput: (e) => this.handleCountrySearch(e.detail), onDropdownClosed: () => this.handleCountryDropdownClosed() })));
|
|
1272
1526
|
}
|
|
1273
1527
|
/** Region select (SA only): shown when SA is selected; city and district disabled until region selected. */
|
|
1274
1528
|
renderRegionSelect() {
|
|
1275
1529
|
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
1276
1530
|
if (!isSA || !this.selectedCountry)
|
|
1277
1531
|
return null;
|
|
1278
|
-
return (h("div", { class: "s-bullet-delivery-field" },
|
|
1279
|
-
const select = e.target;
|
|
1280
|
-
const regionId = Number.parseInt(select.value);
|
|
1281
|
-
const region = this.regions.find((r) => r.id === regionId);
|
|
1282
|
-
this.selectedRegion = region || null;
|
|
1283
|
-
this.updateNewAddressForm({
|
|
1284
|
-
region_id: region?.id,
|
|
1285
|
-
city_id: undefined,
|
|
1286
|
-
district_id: undefined,
|
|
1287
|
-
city: undefined,
|
|
1288
|
-
district: undefined,
|
|
1289
|
-
});
|
|
1290
|
-
if (region && this.selectedCountry) {
|
|
1291
|
-
this.loadCities(this.selectedCountry.id, region.id);
|
|
1292
|
-
}
|
|
1293
|
-
} }, h("option", { value: "", disabled: true, selected: !this.selectedRegion }, Salla.lang.get("pages.checkout.select_region")), this.regions.map((region) => (h("option", { key: region.id, value: region.id, selected: this.selectedRegion?.id === region.id }, region.name))))));
|
|
1532
|
+
return (h("div", { class: "s-bullet-delivery-field" }, h("salla-searchable-dropdown", { label: Salla.lang.get("pages.checkout.region_field"), placeholder: Salla.lang.get("pages.checkout.select_region"), items: this.displayedRegions, selectedItem: this.selectedRegion, loading: this.loadingRegions, searching: this.searchingRegions, disabled: this.loadingRegions || this.regions.length === 0, required: true, inputId: "bullet-delivery-region", searchQuery: this.regionSearchQuery, clientSearch: true, onItemSelected: (e) => this.handleRegionSelected(e.detail), onSearchInput: (e) => this.handleRegionSearch(e.detail), onDropdownClosed: () => this.handleRegionDropdownClosed() })));
|
|
1294
1533
|
}
|
|
1295
1534
|
renderCityDistrictSelects() {
|
|
1296
|
-
// Guest form: region + district only for SA; other countries get country + city only
|
|
1297
1535
|
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
1298
1536
|
const showDistrict = isSA;
|
|
1299
1537
|
const showDistrictInput = showDistrict &&
|
|
1300
1538
|
this.selectedCity &&
|
|
1301
1539
|
!this.loadingDistricts &&
|
|
1302
1540
|
this.districts.length === 0;
|
|
1303
|
-
// For SA: city disabled until region selected; for non-SA: city disabled until country selected
|
|
1304
1541
|
const cityDisabled = !this.selectedCountry ||
|
|
1305
1542
|
(isSA && !this.selectedRegion) ||
|
|
1306
1543
|
this.loadingCities ||
|
|
@@ -1309,39 +1546,11 @@ export class SallaBulletDelivery {
|
|
|
1309
1546
|
(isSA && !this.selectedRegion) ||
|
|
1310
1547
|
!this.selectedCity ||
|
|
1311
1548
|
this.loadingDistricts;
|
|
1312
|
-
return (h("div", { class: "s-bullet-delivery-field-row" }, h("div", { class: "s-bullet-delivery-field" },
|
|
1313
|
-
const select = e.target;
|
|
1314
|
-
const cityId = Number.parseInt(select.value);
|
|
1315
|
-
const city = this.cities.find((c) => c.id === cityId);
|
|
1316
|
-
this.selectedCity = city || null;
|
|
1317
|
-
this.selectedDistrict = null;
|
|
1318
|
-
this.districtName = "";
|
|
1319
|
-
if (city) {
|
|
1320
|
-
this.updateNewAddressForm({ city: city, district: undefined });
|
|
1321
|
-
if (showDistrict) {
|
|
1322
|
-
this.loadDistricts(city.id);
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
} }, h("option", { value: "", disabled: true, selected: !this.selectedCity }, Salla.lang.get("pages.checkout.select_city")), this.cities.map((city) => (h("option", { key: city.id, value: city.id, selected: this.selectedCity?.id === city.id }, city.name))))), showDistrict && (h("div", { class: "s-bullet-delivery-field" }, this.renderLoadingLabel(Salla.lang.get("pages.checkout.district_field"), "bullet-delivery-district", this.loadingDistricts && !showDistrictInput), showDistrictInput ? (h("input", { id: "bullet-delivery-district", type: "text", class: "form-input", placeholder: Salla.lang.get("pages.checkout.select_district"), value: this.districtName, disabled: districtDisabled, onInput: (e) => {
|
|
1549
|
+
return (h("div", { class: "s-bullet-delivery-field-row" }, h("div", { class: "s-bullet-delivery-field" }, h("salla-searchable-dropdown", { label: Salla.lang.get("blocks.buy_as_gift.receiver_city"), placeholder: Salla.lang.get("pages.checkout.select_city"), items: this.displayedCities, selectedItem: this.selectedCity, loading: this.loadingCities, searching: this.searchingCities, disabled: cityDisabled, required: true, inputId: "bullet-delivery-city", searchQuery: this.citySearchQuery, onItemSelected: (e) => this.handleCitySelected(e.detail), onSearchInput: (e) => this.handleCitySearch(e.detail), onDropdownClosed: () => this.handleCityDropdownClosed(), dropUp: true })), showDistrict && (h("div", { class: "s-bullet-delivery-field" }, showDistrictInput ? (h("div", null, h("label", { class: "s-bullet-delivery-label", htmlFor: "bullet-delivery-district" }, Salla.lang.get("pages.checkout.district_field"), h("span", { class: "text-red-500" }, " *")), h("input", { id: "bullet-delivery-district", type: "text", class: "form-input", placeholder: Salla.lang.get("pages.checkout.select_district"), value: this.districtName, disabled: districtDisabled, onInput: (e) => {
|
|
1326
1550
|
const input = e.target;
|
|
1327
1551
|
this.districtName = input.value;
|
|
1328
1552
|
this.updateNewAddressForm({ district: undefined });
|
|
1329
|
-
} })) : (h("
|
|
1330
|
-
const select = e.target;
|
|
1331
|
-
const districtId = Number.parseInt(select.value);
|
|
1332
|
-
const district = this.districts.find((d) => d.id === districtId);
|
|
1333
|
-
this.selectedDistrict = district || null;
|
|
1334
|
-
this.districtName = "";
|
|
1335
|
-
if (district) {
|
|
1336
|
-
this.updateNewAddressForm({ district });
|
|
1337
|
-
}
|
|
1338
|
-
} }, h("option", { value: "", disabled: true, selected: !this.selectedDistrict }, Salla.lang.get("pages.checkout.select_district")), this.districts.map((district) => {
|
|
1339
|
-
const langCode = Salla.config.get("user.language_code");
|
|
1340
|
-
const label = langCode === "ar"
|
|
1341
|
-
? district.name
|
|
1342
|
-
: (district.name_en ?? district.name);
|
|
1343
|
-
return (h("option", { key: district.id, value: district.id, selected: this.selectedDistrict?.id === district.id }, label));
|
|
1344
|
-
})))))));
|
|
1553
|
+
} }))) : (h("salla-searchable-dropdown", { label: Salla.lang.get("pages.checkout.district_field"), placeholder: Salla.lang.get("pages.checkout.select_district"), items: this.displayedDistricts, selectedItem: this.selectedDistrict, loading: this.loadingDistricts, searching: this.searchingDistricts, disabled: districtDisabled || this.districts.length === 0, required: true, inputId: "bullet-delivery-district", searchQuery: this.districtSearchQuery, clientSearch: true, onItemSelected: (e) => this.handleDistrictSelected(e.detail), onSearchInput: (e) => this.handleDistrictSearch(e.detail), onDropdownClosed: () => this.handleDistrictDropdownClosed(), dropUp: true }))))));
|
|
1345
1554
|
}
|
|
1346
1555
|
renderSavedAddressesEmptyState() {
|
|
1347
1556
|
return (h("div", { class: "s-bullet-delivery-saved-addresses-empty" }, h("div", { class: "s-bullet-delivery-saved-addresses-empty-icon", "aria-hidden": "true" }, h("svg", { width: "28", height: "28", viewBox: "0 0 28 29", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("title", null, "No Saved Adresses"), h("path", { d: "M20.16 0C21.4613 0 22.6773 0.341333 23.808 1.024C24.9387 1.70667 25.8347 2.61333 26.496 3.744C27.1787 4.91733 27.52 6.18667 27.52 7.552C27.52 9.45067 26.8267 11.232 25.44 12.896C24.4587 14.0907 23.0827 15.2427 21.312 16.352H21.28C20.9387 16.5653 20.5653 16.672 20.16 16.672C19.7547 16.672 19.3813 16.5653 19.04 16.352H19.008C17.2373 15.2213 15.8613 14.0693 14.88 12.896C13.4933 11.232 12.8 9.45067 12.8 7.552C12.8 6.18667 13.1413 4.91733 13.824 3.744C14.4853 2.61333 15.3813 1.70667 16.512 1.024C17.6427 0.341333 18.8587 0 20.16 0ZM11.488 1.984C9.67467 2.368 8.04267 3.14667 6.592 4.32C5.14133 5.49333 4.01067 6.92267 3.2 8.608C2.34667 10.3573 1.92 12.224 1.92 14.208C1.92 14.72 1.952 15.2427 2.016 15.776L2.08 15.744C2.57067 15.488 2.94933 15.3067 3.216 15.2C3.48267 15.0933 3.73867 15.0933 3.984 15.2C4.22933 15.3067 4.4 15.488 4.496 15.744C4.592 16 4.58667 16.256 4.48 16.512C4.37333 16.768 4.19733 16.9493 3.952 17.056C3.70667 17.1627 3.36 17.3227 2.912 17.536L2.656 17.664C2.57067 17.7067 2.48533 17.7387 2.4 17.76C2.89067 19.4667 3.70133 20.9973 4.832 22.352C5.96267 23.7067 7.296 24.7573 8.832 25.504C10.432 26.272 12.1173 26.656 13.888 26.656C15.4667 26.656 16.9813 26.3467 18.432 25.728C19.8187 25.1307 21.0667 24.288 22.176 23.2C21.92 23.0507 21.7653 22.8373 21.712 22.56C21.6587 22.2827 21.7013 22.0267 21.84 21.792C21.9787 21.5573 22.176 21.408 22.432 21.344C22.8373 21.2587 23.2 21.12 23.52 20.928C23.6907 20.8427 23.8613 20.8 24.032 20.8C24.8 19.5413 25.3333 18.176 25.632 16.704C25.6747 16.4267 25.808 16.2133 26.032 16.064C26.256 15.9147 26.496 15.8667 26.752 15.92C27.008 15.9733 27.2107 16.1173 27.36 16.352C27.5093 16.5867 27.552 16.832 27.488 17.088C27.0613 19.2853 26.1973 21.264 24.896 23.024C23.5947 24.784 22.0053 26.1547 20.128 27.136C18.1653 28.16 16.0853 28.672 13.888 28.672C11.3707 28.672 9.03467 28.0107 6.88 26.688C4.78933 25.408 3.12533 23.68 1.888 21.504C0.629333 19.264 0 16.832 0 14.208C0 11.904 0.490667 9.73867 1.472 7.712C2.41067 5.74933 3.728 4.09067 5.424 2.736C7.12 1.38133 9.01333 0.48 11.104 0.032C11.36 -0.032 11.6 0.0106667 11.824 0.16C12.048 0.309333 12.1867 0.522667 12.24 0.8C12.2933 1.07733 12.2453 1.328 12.096 1.552C11.9467 1.776 11.744 1.92 11.488 1.984ZM14.72 7.552C14.72 8.96 15.2533 10.304 16.32 11.584C17.1733 12.5867 18.3893 13.6 19.968 14.624C20.032 14.6453 20.096 14.656 20.16 14.656C20.224 14.656 20.288 14.6453 20.352 14.624C21.9307 13.6213 23.1467 12.608 24 11.584C25.0667 10.304 25.6 8.96 25.6 7.552C25.6 6.57067 25.3547 5.65333 24.864 4.8C24.3733 3.94667 23.7067 3.26933 22.864 2.768C22.0213 2.26667 21.12 2.016 20.16 2.016C19.2 2.016 18.2987 2.26667 17.456 2.768C16.6133 3.26933 15.9467 3.94667 15.456 4.8C14.9653 5.65333 14.72 6.57067 14.72 7.552ZM17.28 7.68C17.28 6.848 17.5627 6.13867 18.128 5.552C18.6933 4.96533 19.3707 4.672 20.16 4.672C20.9493 4.672 21.6267 4.96533 22.192 5.552C22.7573 6.13867 23.04 6.848 23.04 7.68C23.04 8.512 22.7573 9.216 22.192 9.792C21.6267 10.368 20.9493 10.656 20.16 10.656C19.3707 10.656 18.6933 10.368 18.128 9.792C17.5627 9.216 17.28 8.512 17.28 7.68ZM6.752 14.688C7.62667 14.7733 8.53333 15.0293 9.472 15.456C9.70667 15.5627 9.87733 15.744 9.984 16C10.0907 16.256 10.0907 16.512 9.984 16.768C9.87733 17.024 9.70133 17.2 9.456 17.296C9.21067 17.392 8.97067 17.3867 8.736 17.28C7.94667 16.9387 7.22133 16.736 6.56 16.672C6.28267 16.6293 6.064 16.5013 5.904 16.288C5.744 16.0747 5.68 15.8293 5.712 15.552C5.744 15.2747 5.86133 15.0507 6.064 14.88C6.26667 14.7093 6.496 14.6453 6.752 14.688ZM17.6 20.544C18.304 20.864 18.976 21.0987 19.616 21.248C19.872 21.312 20.0693 21.4613 20.208 21.696C20.3467 21.9307 20.3893 22.1813 20.336 22.448C20.2827 22.7147 20.144 22.9227 19.92 23.072C19.696 23.2213 19.4453 23.264 19.168 23.2C18.4213 23.0293 17.632 22.752 16.8 22.368C16.5653 22.2613 16.4 22.08 16.304 21.824C16.208 21.568 16.2133 21.312 16.32 21.056C16.4267 20.8 16.6027 20.624 16.848 20.528C17.0933 20.432 17.344 20.4373 17.6 20.544ZM12.832 17.44C13.0027 17.568 13.248 17.7493 13.568 17.984L14.496 18.688C14.7093 18.8587 14.8373 19.0773 14.88 19.344C14.9227 19.6107 14.8693 19.856 14.72 20.08C14.5707 20.304 14.368 20.4427 14.112 20.496C13.856 20.5493 13.6107 20.5013 13.376 20.352L11.744 19.072C11.5307 18.9227 11.4027 18.7093 11.36 18.432C11.3173 18.1547 11.3707 17.904 11.52 17.68C11.6693 17.456 11.872 17.3227 12.128 17.28C12.384 17.2373 12.6187 17.2907 12.832 17.44ZM20.16 8.672C20.416 8.672 20.64 8.576 20.832 8.384C21.024 8.192 21.12 7.95733 21.12 7.68C21.12 7.40267 21.024 7.16267 20.832 6.96C20.64 6.75733 20.416 6.656 20.16 6.656C19.904 6.656 19.68 6.75733 19.488 6.96C19.296 7.16267 19.2 7.40267 19.2 7.68C19.2 7.95733 19.296 8.192 19.488 8.384C19.68 8.576 19.904 8.672 20.16 8.672Z", fill: "#666666" }))), h("p", { class: "s-bullet-delivery-saved-addresses-empty-title" }, Salla.lang.get("pages.checkout.no_saved_addresses")), h("p", { class: "s-bullet-delivery-saved-addresses-empty-desc" }, Salla.lang.get("pages.checkout.add_address_simplify_shipping")), h("salla-button", { onClick: () => this.handleAddNewAddress(), onKeyUp: () => this.handleAddNewAddress() }, Salla.lang.get("pages.checkout.add_new_address"))));
|
|
@@ -1517,7 +1726,8 @@ export class SallaBulletDelivery {
|
|
|
1517
1726
|
const submitLabel = this.savingAddress
|
|
1518
1727
|
? Salla.lang.get("pages.checkout.loading")
|
|
1519
1728
|
: Salla.lang.get("pages.checkout.confirm_address");
|
|
1520
|
-
|
|
1729
|
+
const hasAddressesToGoBack = this.savedAddresses.length > 0 || hasSessionAddressIntent(this.getStoredIntent());
|
|
1730
|
+
return (h("div", { class: "s-bullet-delivery-add-address" }, h("div", { class: "s-bullet-delivery-add-address-header" }, hasAddressesToGoBack ? (h("button", { type: "button", class: "s-bullet-delivery-add-address-title", onClick: () => this.handleBackToAddressList(), onKeyDown: (e) => e.key === "Enter" && this.handleBackToAddressList() }, h("span", { innerHTML: this.isRTL ? ArrowRight : ArrowLeft, "aria-hidden": "true" }), h("span", { class: "s-bullet-delivery-add-address-title-text" }, title))) : (h("span", { class: "s-bullet-delivery-add-address-title" }, h("span", { class: "s-bullet-delivery-add-address-title-text" }, title)))), h("form", { class: "s-bullet-delivery-add-address-form", onSubmit: (e) => this.handleSubmitAddAddress(e) }, this.renderGuestDeliveryForm(), h("div", { class: "s-bullet-delivery-form-actions s-bullet-delivery-form-actions--single" }, h("salla-button", { type: "submit", loading: this.savingAddress, disabled: !canSubmit || this.savingAddress, class: "s-bullet-delivery-add-address-submit" }, submitLabel)))));
|
|
1521
1731
|
}
|
|
1522
1732
|
renderFooter() {
|
|
1523
1733
|
const showAddAddressInFooter = this.activeTab === "address" && this.isLoggedIn;
|
|
@@ -1660,9 +1870,9 @@ export class SallaBulletDelivery {
|
|
|
1660
1870
|
}
|
|
1661
1871
|
}
|
|
1662
1872
|
render() {
|
|
1663
|
-
return (h(Host, { key: '
|
|
1873
|
+
return (h(Host, { key: '0daead232faa6590712faef140ab694b3324960e', class: "s-bullet-delivery" }, h("salla-modal", { key: '4f318a88c10b524d5f6b71a46cb93535d4b25a82', ref: (modal) => {
|
|
1664
1874
|
this.modal = modal;
|
|
1665
|
-
}, isClosable: !this.isRequired && !this.shouldForceNonClosable(), class: "s-bullet-delivery-modal",
|
|
1875
|
+
}, isClosable: !this.isRequired && !this.shouldForceNonClosable(), class: "s-bullet-delivery-modal", width: "sm" }, h("div", { key: '66f3d844ce325e47bfb52f941c038339f3f0cf6c', class: "s-bullet-delivery-inner" }, this.viewMode === "main" && this.renderMainView(), this.viewMode === "add-address" && this.renderAddAddressForm()))));
|
|
1666
1876
|
}
|
|
1667
1877
|
componentDidLoad() {
|
|
1668
1878
|
// Mark component as ready
|
|
@@ -1763,7 +1973,6 @@ export class SallaBulletDelivery {
|
|
|
1763
1973
|
}
|
|
1764
1974
|
static get states() {
|
|
1765
1975
|
return {
|
|
1766
|
-
"loading": {},
|
|
1767
1976
|
"activeTab": {},
|
|
1768
1977
|
"isLoggedIn": {},
|
|
1769
1978
|
"viewMode": {},
|
|
@@ -1784,6 +1993,7 @@ export class SallaBulletDelivery {
|
|
|
1784
1993
|
"filteredBranches": {},
|
|
1785
1994
|
"selectedBranch": {},
|
|
1786
1995
|
"branchSearchQuery": {},
|
|
1996
|
+
"loadingCountries": {},
|
|
1787
1997
|
"loadingCities": {},
|
|
1788
1998
|
"loadingDistricts": {},
|
|
1789
1999
|
"loadingBranches": {},
|
|
@@ -1792,6 +2002,18 @@ export class SallaBulletDelivery {
|
|
|
1792
2002
|
"savingAddress": {},
|
|
1793
2003
|
"loadingSavedAddresses": {},
|
|
1794
2004
|
"showCartWillBeClearedBanner": {},
|
|
2005
|
+
"countrySearchQuery": {},
|
|
2006
|
+
"regionSearchQuery": {},
|
|
2007
|
+
"citySearchQuery": {},
|
|
2008
|
+
"districtSearchQuery": {},
|
|
2009
|
+
"searchingCountries": {},
|
|
2010
|
+
"searchingRegions": {},
|
|
2011
|
+
"searchingCities": {},
|
|
2012
|
+
"searchingDistricts": {},
|
|
2013
|
+
"displayedCountries": {},
|
|
2014
|
+
"displayedRegions": {},
|
|
2015
|
+
"displayedCities": {},
|
|
2016
|
+
"displayedDistricts": {},
|
|
1795
2017
|
"allocationOutOfCoverageMessage": {},
|
|
1796
2018
|
"newAddressForm": {}
|
|
1797
2019
|
};
|
|
@@ -1935,3 +2157,5 @@ SallaBulletDelivery.INITIAL_ADDRESS_FORM = {
|
|
|
1935
2157
|
postal_code: undefined,
|
|
1936
2158
|
description: undefined,
|
|
1937
2159
|
};
|
|
2160
|
+
SallaBulletDelivery.DROPDOWN_SEARCH_DEBOUNCE_MS = 400;
|
|
2161
|
+
SallaBulletDelivery.DROPDOWN_SEARCH_MIN_CHARS = 2;
|