@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,13 +2,14 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { S as Search } from './search.js';
|
|
6
|
-
import { L as Location } from './location.js';
|
|
7
5
|
import { a as KeyBoardArrowRightIcon, K as KeyBoardArrowLeftIcon } from './keyboard_arrow_right.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { d as defineCustomElement$
|
|
11
|
-
import { d as defineCustomElement$
|
|
6
|
+
import { L as Location } from './location.js';
|
|
7
|
+
import { S as Search } from './search.js';
|
|
8
|
+
import { d as defineCustomElement$7 } from './salla-button2.js';
|
|
9
|
+
import { d as defineCustomElement$6 } from './salla-loading2.js';
|
|
10
|
+
import { d as defineCustomElement$5 } from './salla-modal2.js';
|
|
11
|
+
import { d as defineCustomElement$4 } from './salla-placeholder2.js';
|
|
12
|
+
import { d as defineCustomElement$3 } from './salla-searchable-dropdown2.js';
|
|
12
13
|
import { d as defineCustomElement$2 } from './salla-skeleton2.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -29,6 +30,19 @@ async function withApiErrorHandling(fn, fallback, logLabel) {
|
|
|
29
30
|
return fallback;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
33
|
+
const apiCache = new Map();
|
|
34
|
+
const CACHE_TTL = 5 * 60 * 1000;
|
|
35
|
+
function getCached(key) {
|
|
36
|
+
const entry = apiCache.get(key);
|
|
37
|
+
if (!entry || Date.now() - entry.timestamp > CACHE_TTL) {
|
|
38
|
+
apiCache.delete(key);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return entry.data;
|
|
42
|
+
}
|
|
43
|
+
function setCache(key, data) {
|
|
44
|
+
apiCache.set(key, { data, timestamp: Date.now() });
|
|
45
|
+
}
|
|
32
46
|
/** Uses country code from API (e.g. 'SA'). */
|
|
33
47
|
const isSaudiArabia = (countryCode) => String(countryCode).toUpperCase() === 'SA';
|
|
34
48
|
/**
|
|
@@ -40,53 +54,94 @@ const bulletDeliveryAPI = {
|
|
|
40
54
|
* Get available countries from Salla shipping API
|
|
41
55
|
* @param forBranch - when true, use for_branch=1 (e.g. for pickup/branches tab)
|
|
42
56
|
*/
|
|
43
|
-
async getCountries(forBranch = false) {
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
async getCountries(forBranch = false, query) {
|
|
58
|
+
const cacheKey = !query?.trim() ? `countries_${forBranch ? 1 : 0}` : null;
|
|
59
|
+
if (cacheKey) {
|
|
60
|
+
const cached = getCached(cacheKey);
|
|
61
|
+
if (cached)
|
|
62
|
+
return cached;
|
|
63
|
+
}
|
|
64
|
+
const result = await withApiErrorHandling(async () => {
|
|
65
|
+
const params = { for_branch: forBranch ? 1 : 0 };
|
|
66
|
+
if (forBranch) {
|
|
67
|
+
params.for_allocation = 1;
|
|
68
|
+
}
|
|
69
|
+
if (query?.trim())
|
|
70
|
+
params.query = query.trim();
|
|
71
|
+
const data = (await salla.api.request("shipping/countries", { params }))?.data ?? [];
|
|
46
72
|
return data.map((c) => ({ id: c.id, code: c.code, name: c.name, has_regions: isSaudiArabia(c.code) }));
|
|
47
73
|
}, [], 'Error getting countries');
|
|
74
|
+
if (cacheKey && result.length > 0)
|
|
75
|
+
setCache(cacheKey, result);
|
|
76
|
+
return result;
|
|
48
77
|
},
|
|
49
78
|
/**
|
|
50
79
|
* Get regions for a country from Salla shipping API
|
|
51
80
|
* Endpoint: GET /shipping/countries/<COUNTRY_ID>/region
|
|
52
81
|
*/
|
|
53
|
-
async getRegions(countryId) {
|
|
82
|
+
async getRegions(countryId, query) {
|
|
54
83
|
if (!validId(countryId)) {
|
|
55
84
|
console.warn(`${API_LOG_PREFIX}: getRegions called without valid country_id`);
|
|
56
85
|
return [];
|
|
57
86
|
}
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
const cacheKey = !query?.trim() ? `regions_${countryId}` : null;
|
|
88
|
+
if (cacheKey) {
|
|
89
|
+
const cached = getCached(cacheKey);
|
|
90
|
+
if (cached)
|
|
91
|
+
return cached;
|
|
92
|
+
}
|
|
93
|
+
const result = await withApiErrorHandling(async () => {
|
|
94
|
+
const params = {};
|
|
95
|
+
if (query?.trim())
|
|
96
|
+
params.query = query.trim();
|
|
97
|
+
const data = (await salla.api.request(`shipping/countries/${countryId}/regions`, { params }))?.data ?? [];
|
|
60
98
|
return data.map((r) => ({ id: r.id, name: r.name, code: r.code, country_id: Number(countryId) }));
|
|
61
99
|
}, [], 'Error fetching regions');
|
|
100
|
+
if (cacheKey && result.length > 0)
|
|
101
|
+
setCache(cacheKey, result);
|
|
102
|
+
return result;
|
|
62
103
|
},
|
|
63
104
|
/**
|
|
64
105
|
* Get cities from Salla shipping API
|
|
65
106
|
* @param regionId - Optional; when provided (e.g. for SA), cities are filtered by region
|
|
66
107
|
*/
|
|
67
|
-
async getCities(countryId, regionId) {
|
|
108
|
+
async getCities(countryId, regionId, query) {
|
|
68
109
|
if (!validId(countryId)) {
|
|
69
110
|
console.warn(`${API_LOG_PREFIX}: getCities called without valid country_id`);
|
|
70
111
|
return [];
|
|
71
112
|
}
|
|
72
|
-
|
|
113
|
+
const cacheKey = !query?.trim() ? `cities_${countryId}_${regionId || 'all'}` : null;
|
|
114
|
+
if (cacheKey) {
|
|
115
|
+
const cached = getCached(cacheKey);
|
|
116
|
+
if (cached)
|
|
117
|
+
return cached;
|
|
118
|
+
}
|
|
119
|
+
const result = await withApiErrorHandling(async () => {
|
|
73
120
|
const params = { for_branch: 0, country_id: countryId };
|
|
74
121
|
if (regionId)
|
|
75
122
|
params.region_id = regionId;
|
|
123
|
+
if (query?.trim())
|
|
124
|
+
params.query = query.trim();
|
|
76
125
|
const data = (await salla.api.request("shipping/cities", { params }))?.data ?? [];
|
|
77
126
|
return data.map((c) => ({ id: c.id, name: c.name, country_id: countryId, ...(c.region_id != null && { region_id: c.region_id }) }));
|
|
78
127
|
}, [], 'Error fetching cities');
|
|
128
|
+
if (cacheKey && result.length > 0)
|
|
129
|
+
setCache(cacheKey, result);
|
|
130
|
+
return result;
|
|
79
131
|
},
|
|
80
132
|
/**
|
|
81
133
|
* Get districts from Salla shipping API
|
|
82
134
|
*/
|
|
83
|
-
async getDistricts(cityId) {
|
|
135
|
+
async getDistricts(cityId, query) {
|
|
84
136
|
if (!validId(cityId)) {
|
|
85
137
|
console.warn(`${API_LOG_PREFIX}: getDistricts called without valid city_id`);
|
|
86
138
|
return [];
|
|
87
139
|
}
|
|
88
140
|
return withApiErrorHandling(async () => {
|
|
89
|
-
const
|
|
141
|
+
const params = { for_branch: 0, city_id: cityId };
|
|
142
|
+
if (query?.trim())
|
|
143
|
+
params.query = query.trim();
|
|
144
|
+
const raw = (await salla.api.request("shipping/districts", { params }))?.data;
|
|
90
145
|
const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.districts) ? raw.districts : []);
|
|
91
146
|
return list.map((d) => ({ id: d.id, name: d.name, name_en: d.name_en, city_id: cityId }));
|
|
92
147
|
}, [], 'Error fetching districts');
|
|
@@ -98,7 +153,14 @@ const bulletDeliveryAPI = {
|
|
|
98
153
|
}, [], 'Error fetching user addresses');
|
|
99
154
|
},
|
|
100
155
|
async getBranches({ query, lat, lng, country_id, per_page = 20 } = {}) {
|
|
101
|
-
|
|
156
|
+
const hasSearchParams = query?.trim()?.length >= 2 || lat || lng;
|
|
157
|
+
const cacheKey = !hasSearchParams && country_id ? `branches_${country_id}` : null;
|
|
158
|
+
if (cacheKey) {
|
|
159
|
+
const cached = getCached(cacheKey);
|
|
160
|
+
if (cached)
|
|
161
|
+
return cached;
|
|
162
|
+
}
|
|
163
|
+
const result = await withApiErrorHandling(async () => {
|
|
102
164
|
const params = { per_page };
|
|
103
165
|
if (query?.trim().length >= 2)
|
|
104
166
|
params.query = query;
|
|
@@ -111,6 +173,9 @@ const bulletDeliveryAPI = {
|
|
|
111
173
|
const res = await salla.api.request("branches", { params });
|
|
112
174
|
return (Array.isArray(res?.data) ? res.data : []);
|
|
113
175
|
}, [], 'Error fetching branches');
|
|
176
|
+
if (cacheKey && result.length > 0)
|
|
177
|
+
setCache(cacheKey, result);
|
|
178
|
+
return result;
|
|
114
179
|
},
|
|
115
180
|
async saveAddressLocation(payload) {
|
|
116
181
|
return withApiErrorHandling(async () => {
|
|
@@ -122,7 +187,7 @@ const bulletDeliveryAPI = {
|
|
|
122
187
|
},
|
|
123
188
|
async setDeliveryScope(scopeId) {
|
|
124
189
|
return withApiErrorHandling(async () => {
|
|
125
|
-
await salla.scope.change({ id: scopeId });
|
|
190
|
+
await salla.api.withoutNotifier(() => salla.scope.change({ id: scopeId }));
|
|
126
191
|
salla.storage.set("scope", { ...(salla.storage.get("scope") || {}), id: scopeId });
|
|
127
192
|
return true;
|
|
128
193
|
}, false, 'Error setting delivery scope');
|
|
@@ -130,7 +195,7 @@ const bulletDeliveryAPI = {
|
|
|
130
195
|
async allocateScope(payload) {
|
|
131
196
|
const errMsg = (d) => d?.error?.message ?? d?.message ?? 'Failed to allocate scope';
|
|
132
197
|
try {
|
|
133
|
-
const response = await salla.api.request("scopes/allocation", payload, 'post');
|
|
198
|
+
const response = await salla.api.withoutNotifier(() => salla.api.request("scopes/allocation", payload, 'post'));
|
|
134
199
|
// SDK resolves with { data } and throws on non-2xx; any resolved value is success
|
|
135
200
|
const data = response?.data ?? response;
|
|
136
201
|
return { success: true, data: data };
|
|
@@ -142,6 +207,9 @@ const bulletDeliveryAPI = {
|
|
|
142
207
|
}
|
|
143
208
|
},
|
|
144
209
|
};
|
|
210
|
+
function clearApiCache() {
|
|
211
|
+
apiCache.clear();
|
|
212
|
+
}
|
|
145
213
|
|
|
146
214
|
/**
|
|
147
215
|
* Helper functions for salla-bullet-delivery component
|
|
@@ -249,16 +317,10 @@ const GEO_ERROR_MESSAGES = {
|
|
|
249
317
|
};
|
|
250
318
|
const getGeolocationErrorMessage = (errorCode) => GEO_ERROR_MESSAGES[errorCode] ?? 'An error occurred while detecting location';
|
|
251
319
|
|
|
252
|
-
var
|
|
253
|
-
<path
|
|
254
|
-
d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"
|
|
255
|
-
stroke="currentcolor" stroke-linecap="round" />
|
|
256
|
-
<path
|
|
257
|
-
d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"
|
|
258
|
-
stroke="currentcolor" stroke-linecap="round" />
|
|
320
|
+
var GetDirections = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
259
321
|
<path
|
|
260
|
-
d="
|
|
261
|
-
stroke="
|
|
322
|
+
d="M7.94798 3.19336C11.1309 2.1083 12.7223 1.56578 13.5783 2.42174C14.4342 3.27771 13.8917 4.86914 12.8066 8.05201L12.0678 10.2195C11.2344 12.6639 10.8178 13.8861 10.131 13.9872C9.94631 14.0144 9.75517 13.9981 9.57248 13.9394C8.89297 13.7212 8.53377 12.4326 7.81538 9.8553C7.65604 9.28364 7.57637 8.99781 7.39494 8.7795C7.34228 8.71614 7.28386 8.65772 7.2205 8.60506C7.00219 8.42363 6.71636 8.34396 6.1447 8.18462C3.56741 7.46623 2.27876 7.10703 2.0606 6.42752C2.00195 6.24483 1.98558 6.05369 2.01277 5.86903C2.11392 5.18221 3.33613 4.76556 5.78054 3.93225L7.94798 3.19336Z"
|
|
323
|
+
stroke="#555555" stroke-width="1.2" />
|
|
262
324
|
</svg>
|
|
263
325
|
`;
|
|
264
326
|
|
|
@@ -312,17 +374,30 @@ var MiniMap = `<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns
|
|
|
312
374
|
</svg>
|
|
313
375
|
`;
|
|
314
376
|
|
|
315
|
-
var
|
|
377
|
+
var Store = `<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
316
378
|
<path
|
|
317
|
-
d="
|
|
318
|
-
stroke="
|
|
379
|
+
d="M1.14453 5.83032L1.14453 9.16486C1.14453 11.0511 1.14453 11.9943 1.73032 12.5803C2.3161 13.1663 3.25891 13.1663 5.14453 13.1663L9.14453 13.1663C11.0301 13.1663 11.9729 13.1663 12.5587 12.5803C13.1445 11.9943 13.1445 11.0511 13.1445 9.16486V5.83032"
|
|
380
|
+
stroke="currentcolor" stroke-linecap="round" />
|
|
381
|
+
<path
|
|
382
|
+
d="M9.14453 10.1619C8.68846 10.5667 7.9624 10.8285 7.14453 10.8285C6.32666 10.8285 5.60059 10.5667 5.14453 10.1619"
|
|
383
|
+
stroke="currentcolor" stroke-linecap="round" />
|
|
384
|
+
<path
|
|
385
|
+
d="M5.90256 4.44533C5.71455 5.12426 5.03086 6.29542 3.73185 6.46516C2.58488 6.61502 1.71497 6.11437 1.49277 5.90504C1.24779 5.7353 0.689441 5.19216 0.552703 4.85269C0.415966 4.51322 0.575492 3.77771 0.689441 3.47785L1.14495 2.15892C1.25615 1.82765 1.51646 1.04411 1.78334 0.779094C2.05022 0.514073 2.59054 0.502543 2.81294 0.502543L7.48329 0.502543C8.68543 0.519525 11.3139 0.491824 11.8335 0.502545C12.3532 0.513266 12.6654 0.948828 12.7565 1.13553C13.5318 3.01341 13.8333 4.08889 13.8333 4.54717C13.7321 5.03605 13.3133 5.95787 11.8335 6.36332C10.2956 6.7847 9.42363 5.96509 9.15007 5.65043M5.27015 5.65044C5.48665 5.91635 6.16578 6.45158 7.15029 6.46516C8.1348 6.47873 8.98485 5.79188 9.28681 5.44676C9.37227 5.34492 9.55687 5.04279 9.7483 4.44533"
|
|
386
|
+
stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round" />
|
|
319
387
|
</svg>
|
|
320
388
|
`;
|
|
321
389
|
|
|
322
|
-
const sallaBulletDeliveryCss = "@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";
|
|
390
|
+
const sallaBulletDeliveryCss = "@supports (interpolate-size: allow-keywords) and (block-size: calc-size(auto, size)) {\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body, .s-bullet-delivery-inner {\n @apply [interpolate-size:allow-keywords];\n }\n .s-bullet-delivery .s-bullet-delivery-modal .s-modal-body {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n }\n .s-bullet-delivery-inner {\n @apply [overflow:clip] [transition:block-size_500ms_ease];\n block-size: calc-size(auto, size);\n }\n}\n\n/* Allow searchable dropdown popover to paint outside the modal body */\n.s-bullet-delivery .s-bullet-delivery-modal .s-modal-body:has(.s-searchable-dropdown--open) {\n overflow: visible !important;\n}\n\n@keyframes s-bullet-delivery-fade-in {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}";
|
|
323
391
|
|
|
324
392
|
const BRANCH_SEARCH_DEBOUNCE_MS = 1000;
|
|
325
393
|
const GEOLOCATION_TIMEOUT = 10000;
|
|
394
|
+
const DEBUG_KEY = 'salla-bullet-delivery-debug';
|
|
395
|
+
const OVERRIDE_IP_KEY = 'salla-bullet-delivery-override-ip';
|
|
396
|
+
function log(message, data) {
|
|
397
|
+
if (localStorage.getItem(DEBUG_KEY)) {
|
|
398
|
+
data !== undefined ? console.log(message, data) : console.log(message);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
326
401
|
const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBulletDelivery extends HTMLElement {
|
|
327
402
|
constructor() {
|
|
328
403
|
super();
|
|
@@ -336,6 +411,11 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
336
411
|
this.pendingCartSubmitPromise = null;
|
|
337
412
|
this.cartSubmitConfirmationPending = false;
|
|
338
413
|
this.branchSearchDebounceTimer = null;
|
|
414
|
+
this.countrySearchTimer = null;
|
|
415
|
+
this.regionSearchTimer = null;
|
|
416
|
+
this.citySearchTimer = null;
|
|
417
|
+
this.districtSearchTimer = null;
|
|
418
|
+
this.citySearchCounter = 0;
|
|
339
419
|
this.componentReady = false;
|
|
340
420
|
this.pendingOpen = false;
|
|
341
421
|
this.tabChanging = false;
|
|
@@ -362,7 +442,6 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
362
442
|
/** True after saved addresses have been loaded (lazy: only when address tab is shown). */
|
|
363
443
|
this.savedAddressesLoaded = false;
|
|
364
444
|
// Core state
|
|
365
|
-
this.loading = true;
|
|
366
445
|
this.activeTab = "address";
|
|
367
446
|
this.isLoggedIn = false;
|
|
368
447
|
this.viewMode = "main";
|
|
@@ -388,6 +467,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
388
467
|
this.selectedBranch = null;
|
|
389
468
|
this.branchSearchQuery = "";
|
|
390
469
|
// Loading states
|
|
470
|
+
this.loadingCountries = false;
|
|
391
471
|
this.loadingCities = false;
|
|
392
472
|
this.loadingDistricts = false;
|
|
393
473
|
this.loadingBranches = false;
|
|
@@ -396,11 +476,95 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
396
476
|
this.savingAddress = false;
|
|
397
477
|
this.loadingSavedAddresses = false;
|
|
398
478
|
this.showCartWillBeClearedBanner = false;
|
|
479
|
+
// Searchable dropdown state
|
|
480
|
+
this.countrySearchQuery = '';
|
|
481
|
+
this.regionSearchQuery = '';
|
|
482
|
+
this.citySearchQuery = '';
|
|
483
|
+
this.districtSearchQuery = '';
|
|
484
|
+
this.searchingCountries = false;
|
|
485
|
+
this.searchingRegions = false;
|
|
486
|
+
this.searchingCities = false;
|
|
487
|
+
this.searchingDistricts = false;
|
|
488
|
+
this.displayedCountries = [];
|
|
489
|
+
this.displayedRegions = [];
|
|
490
|
+
this.displayedCities = [];
|
|
491
|
+
this.displayedDistricts = [];
|
|
399
492
|
/** Shown when scopes/allocation returns 422 (address outside delivery coverage). Only on delivery tab. */
|
|
400
493
|
this.allocationOutOfCoverageMessage = null;
|
|
401
494
|
this.newAddressForm = {
|
|
402
495
|
...SallaBulletDelivery.INITIAL_ADDRESS_FORM,
|
|
403
496
|
};
|
|
497
|
+
this.handleCountrySearch = (query) => {
|
|
498
|
+
this.countrySearchQuery = query;
|
|
499
|
+
return;
|
|
500
|
+
};
|
|
501
|
+
this.handleRegionSearch = (query) => {
|
|
502
|
+
this.regionSearchQuery = query;
|
|
503
|
+
return;
|
|
504
|
+
};
|
|
505
|
+
this.handleCitySearch = (query) => {
|
|
506
|
+
this.citySearchQuery = query;
|
|
507
|
+
if (this.citySearchTimer)
|
|
508
|
+
clearTimeout(this.citySearchTimer);
|
|
509
|
+
if (!query.trim()) {
|
|
510
|
+
this.displayedCities = this.cities;
|
|
511
|
+
this.searchingCities = false;
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (query.trim().length < SallaBulletDelivery.DROPDOWN_SEARCH_MIN_CHARS)
|
|
515
|
+
return;
|
|
516
|
+
const requestId = ++this.citySearchCounter;
|
|
517
|
+
this.citySearchTimer = setTimeout(async () => {
|
|
518
|
+
this.searchingCities = true;
|
|
519
|
+
try {
|
|
520
|
+
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
521
|
+
const regionId = isSA ? this.selectedRegion?.id : undefined;
|
|
522
|
+
const results = await bulletDeliveryAPI.getCities(this.selectedCountry?.id, regionId, query);
|
|
523
|
+
if (requestId === this.citySearchCounter) {
|
|
524
|
+
this.displayedCities = results;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
catch {
|
|
528
|
+
if (requestId === this.citySearchCounter) {
|
|
529
|
+
this.displayedCities = this.cities;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
finally {
|
|
533
|
+
if (requestId === this.citySearchCounter) {
|
|
534
|
+
this.searchingCities = false;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}, SallaBulletDelivery.DROPDOWN_SEARCH_DEBOUNCE_MS);
|
|
538
|
+
};
|
|
539
|
+
this.handleDistrictSearch = (query) => {
|
|
540
|
+
this.districtSearchQuery = query;
|
|
541
|
+
return;
|
|
542
|
+
};
|
|
543
|
+
this.handleCountryDropdownClosed = () => {
|
|
544
|
+
this.countrySearchQuery = '';
|
|
545
|
+
this.displayedCountries = this.countries;
|
|
546
|
+
this.searchingCountries = false;
|
|
547
|
+
};
|
|
548
|
+
this.handleRegionDropdownClosed = () => {
|
|
549
|
+
this.regionSearchQuery = '';
|
|
550
|
+
this.displayedRegions = this.regions;
|
|
551
|
+
this.searchingRegions = false;
|
|
552
|
+
};
|
|
553
|
+
this.handleCityDropdownClosed = () => {
|
|
554
|
+
this.citySearchQuery = '';
|
|
555
|
+
if (this.citySearchTimer) {
|
|
556
|
+
clearTimeout(this.citySearchTimer);
|
|
557
|
+
this.citySearchTimer = null;
|
|
558
|
+
}
|
|
559
|
+
++this.citySearchCounter;
|
|
560
|
+
this.displayedCities = this.cities;
|
|
561
|
+
this.searchingCities = false;
|
|
562
|
+
};
|
|
563
|
+
this.handleDistrictDropdownClosed = () => {
|
|
564
|
+
this.districtSearchQuery = '';
|
|
565
|
+
this.displayedDistricts = this.districts;
|
|
566
|
+
this.searchingDistricts = false;
|
|
567
|
+
};
|
|
404
568
|
/**
|
|
405
569
|
* Submit add-address form: create address via API then switch back to list.
|
|
406
570
|
*/
|
|
@@ -439,10 +603,61 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
439
603
|
this.savingAddress = false;
|
|
440
604
|
}
|
|
441
605
|
};
|
|
606
|
+
this.handleCountrySelected = (item) => {
|
|
607
|
+
const country = this.countries.find(c => String(c.id) === String(item.id)) || item;
|
|
608
|
+
const isCountrySwitch = this.selectedCountry &&
|
|
609
|
+
country &&
|
|
610
|
+
this.selectedCountry.code !== country.code;
|
|
611
|
+
this.showCartWillBeClearedBanner = !!isCountrySwitch;
|
|
612
|
+
this.countrySearchQuery = '';
|
|
613
|
+
this.displayedCountries = this.countries;
|
|
614
|
+
this.applyCountryChange(country || null);
|
|
615
|
+
};
|
|
616
|
+
this.handleRegionSelected = (item) => {
|
|
617
|
+
const region = this.regions.find(r => String(r.id) === String(item.id)) || item;
|
|
618
|
+
this.selectedRegion = region || null;
|
|
619
|
+
this.regionSearchQuery = '';
|
|
620
|
+
this.displayedRegions = this.regions;
|
|
621
|
+
this.updateNewAddressForm({
|
|
622
|
+
region_id: region?.id,
|
|
623
|
+
city_id: undefined,
|
|
624
|
+
district_id: undefined,
|
|
625
|
+
city: undefined,
|
|
626
|
+
district: undefined,
|
|
627
|
+
});
|
|
628
|
+
if (region && this.selectedCountry) {
|
|
629
|
+
this.loadCities(this.selectedCountry.id, region.id);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
this.handleCitySelected = (item) => {
|
|
633
|
+
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
634
|
+
const city = this.cities.find(c => String(c.id) === String(item.id)) || item;
|
|
635
|
+
this.selectedCity = city || null;
|
|
636
|
+
this.selectedDistrict = null;
|
|
637
|
+
this.districtName = "";
|
|
638
|
+
this.citySearchQuery = '';
|
|
639
|
+
this.displayedCities = this.cities;
|
|
640
|
+
if (city) {
|
|
641
|
+
this.updateNewAddressForm({ city: city, district: undefined });
|
|
642
|
+
if (isSA) {
|
|
643
|
+
this.loadDistricts(city.id);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
this.handleDistrictSelected = (item) => {
|
|
648
|
+
const district = this.districts.find(d => String(d.id) === String(item.id)) || item;
|
|
649
|
+
this.selectedDistrict = district || null;
|
|
650
|
+
this.districtName = "";
|
|
651
|
+
this.districtSearchQuery = '';
|
|
652
|
+
this.displayedDistricts = this.districts;
|
|
653
|
+
if (district) {
|
|
654
|
+
this.updateNewAddressForm({ district });
|
|
655
|
+
}
|
|
656
|
+
};
|
|
442
657
|
}
|
|
443
|
-
/** Whether to show delivery + pickup tabs. From store.
|
|
658
|
+
/** Whether to show delivery + pickup tabs. From store.shipping.support_pickup */
|
|
444
659
|
get supportsPickup() {
|
|
445
|
-
return
|
|
660
|
+
return Boolean(Salla.config.get("store.shipping.support_pickup"));
|
|
446
661
|
}
|
|
447
662
|
/** The modal opening strategy: 'first_visit' | 'on_cart_click' | 'after_add_to_cart' */
|
|
448
663
|
get openingType() {
|
|
@@ -461,10 +676,9 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
461
676
|
this.pendingOpen = true;
|
|
462
677
|
return;
|
|
463
678
|
}
|
|
464
|
-
// Reset state
|
|
679
|
+
// Reset state before opening
|
|
465
680
|
this.resetState();
|
|
466
|
-
|
|
467
|
-
// Open modal immediately to show skeleton/loading state
|
|
681
|
+
// Open modal immediately — fields render right away with inline loading
|
|
468
682
|
this.modal.open();
|
|
469
683
|
Salla.event.dispatch("salla::bullet-delivery.modal.opened");
|
|
470
684
|
try {
|
|
@@ -485,11 +699,16 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
485
699
|
this.activeTab = "address";
|
|
486
700
|
}
|
|
487
701
|
// Load countries always; load saved addresses only when address tab is active (lazy tab data).
|
|
702
|
+
if (this.isLoggedIn && this.activeTab === "address") {
|
|
703
|
+
this.loadingSavedAddresses = true;
|
|
704
|
+
}
|
|
488
705
|
await Promise.all([
|
|
489
706
|
this.loadCountries(hasStoredAddressIds),
|
|
490
707
|
this.isLoggedIn && this.activeTab === "address"
|
|
491
708
|
? this.loadSavedAddresses().then(() => {
|
|
492
709
|
this.savedAddressesLoaded = true;
|
|
710
|
+
}).finally(() => {
|
|
711
|
+
this.loadingSavedAddresses = false;
|
|
493
712
|
})
|
|
494
713
|
: Promise.resolve(),
|
|
495
714
|
]);
|
|
@@ -527,9 +746,6 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
527
746
|
console.error("SallaBulletDelivery: Error loading data", e);
|
|
528
747
|
}
|
|
529
748
|
finally {
|
|
530
|
-
// Only hide loading after all data is loaded and UI is ready
|
|
531
|
-
this.loading = false;
|
|
532
|
-
this.modal?.stopLoading();
|
|
533
749
|
this.overrideScopeSwitchUI();
|
|
534
750
|
}
|
|
535
751
|
}
|
|
@@ -564,12 +780,13 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
564
780
|
this.branches = [];
|
|
565
781
|
this.filteredBranches = [];
|
|
566
782
|
this.newAddressForm = { ...SallaBulletDelivery.INITIAL_ADDRESS_FORM };
|
|
567
|
-
// Reset new state variables
|
|
568
783
|
this.showCartWillBeClearedBanner = false;
|
|
569
784
|
this.allocationOutOfCoverageMessage = null;
|
|
570
785
|
this.locationError = "";
|
|
571
786
|
this.savedAddressesLoaded = false;
|
|
572
787
|
this.loadingSavedAddresses = false;
|
|
788
|
+
this.loadingCountries = false;
|
|
789
|
+
this.resetSearchState();
|
|
573
790
|
}
|
|
574
791
|
getIntentStorage() {
|
|
575
792
|
const rememberLastSession = Boolean(Salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"));
|
|
@@ -696,10 +913,14 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
696
913
|
? bulletDeliveryAPI.getDistricts(Number(cityId))
|
|
697
914
|
: Promise.resolve([]),
|
|
698
915
|
]);
|
|
699
|
-
if (isSA)
|
|
916
|
+
if (isSA) {
|
|
700
917
|
this.regions = regions;
|
|
918
|
+
this.displayedRegions = this.regions;
|
|
919
|
+
}
|
|
701
920
|
this.cities = cities;
|
|
921
|
+
this.displayedCities = this.cities;
|
|
702
922
|
this.districts = districts;
|
|
923
|
+
this.displayedDistricts = this.districts;
|
|
703
924
|
this.loadingCities = false;
|
|
704
925
|
this.loadingRegions = false;
|
|
705
926
|
this.loadingDistricts = false;
|
|
@@ -742,41 +963,117 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
742
963
|
const storage = this.getShownStorage();
|
|
743
964
|
storage.set(this.sessionShownKey, true);
|
|
744
965
|
}
|
|
966
|
+
getIPLocationConfig() {
|
|
967
|
+
const configPath = "store.shipping.delivery_location";
|
|
968
|
+
const ipAddress = {
|
|
969
|
+
countryId: Salla.config.get(`${configPath}.country_id`),
|
|
970
|
+
regionId: Salla.config.get(`${configPath}.region_id`),
|
|
971
|
+
cityId: Salla.config.get(`${configPath}.city_id`),
|
|
972
|
+
districtId: Salla.config.get(`${configPath}.district_id`),
|
|
973
|
+
};
|
|
974
|
+
return localStorage.getItem(OVERRIDE_IP_KEY) ?
|
|
975
|
+
JSON.parse(localStorage.getItem(OVERRIDE_IP_KEY)) : ipAddress;
|
|
976
|
+
}
|
|
745
977
|
async loadCountries(skipEagerSubFetch = false) {
|
|
978
|
+
this.loadingCountries = true;
|
|
746
979
|
const forBranch = this.activeTab === "branch";
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
if (
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
980
|
+
try {
|
|
981
|
+
this.countries = await bulletDeliveryAPI.getCountries(forBranch);
|
|
982
|
+
this.displayedCountries = this.countries;
|
|
983
|
+
const { countryId: configCountryId, regionId: configRegionId, cityId: configCityId, districtId: configDistrictId } = this.getIPLocationConfig();
|
|
984
|
+
log("getIPLocationConfig", this.getIPLocationConfig());
|
|
985
|
+
const countryToSelect = configCountryId && this.countries.length > 0
|
|
986
|
+
? this.countries.find((c) => String(c.id) === String(configCountryId))
|
|
987
|
+
: null;
|
|
988
|
+
if (countryToSelect) {
|
|
989
|
+
this.selectedCountry = countryToSelect;
|
|
990
|
+
this.updateNewAddressForm({
|
|
991
|
+
country_id: Number(this.selectedCountry.id),
|
|
992
|
+
});
|
|
993
|
+
// Skip eager sub-fetches when stored intent IDs exist — prefillFromSessionStorage
|
|
994
|
+
// will fire regions/cities/districts in parallel using the stored IDs directly.
|
|
995
|
+
if (!skipEagerSubFetch) {
|
|
996
|
+
const hasIPLocationIds = configRegionId != null ||
|
|
997
|
+
configCityId != null ||
|
|
998
|
+
configDistrictId != null;
|
|
999
|
+
if (hasIPLocationIds) {
|
|
1000
|
+
await this.prefillFromIPLocation(countryToSelect, {
|
|
1001
|
+
regionId: configRegionId,
|
|
1002
|
+
cityId: configCityId,
|
|
1003
|
+
districtId: configDistrictId,
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
else if (isSaudiArabia(this.selectedCountry.code)) {
|
|
1007
|
+
await this.loadRegions(this.selectedCountry.id);
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
await this.loadCities(this.selectedCountry.id);
|
|
1011
|
+
}
|
|
767
1012
|
}
|
|
768
1013
|
}
|
|
769
1014
|
}
|
|
1015
|
+
finally {
|
|
1016
|
+
this.loadingCountries = false;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
async prefillFromIPLocation(country, ids) {
|
|
1020
|
+
const isSA = isSaudiArabia(country.code);
|
|
1021
|
+
const { regionId, cityId, districtId } = ids;
|
|
1022
|
+
const [regions, cities, districts] = await Promise.all([
|
|
1023
|
+
isSA ? bulletDeliveryAPI.getRegions(country.id) : Promise.resolve([]),
|
|
1024
|
+
bulletDeliveryAPI.getCities(country.id, isSA && regionId != null ? regionId : undefined),
|
|
1025
|
+
cityId != null
|
|
1026
|
+
? bulletDeliveryAPI.getDistricts(Number(cityId))
|
|
1027
|
+
: Promise.resolve([]),
|
|
1028
|
+
]);
|
|
1029
|
+
if (isSA) {
|
|
1030
|
+
this.regions = regions;
|
|
1031
|
+
this.displayedRegions = this.regions;
|
|
1032
|
+
}
|
|
1033
|
+
this.cities = cities;
|
|
1034
|
+
this.displayedCities = this.cities;
|
|
1035
|
+
this.districts = districts;
|
|
1036
|
+
this.displayedDistricts = this.districts;
|
|
1037
|
+
this.loadingRegions = false;
|
|
1038
|
+
this.loadingCities = false;
|
|
1039
|
+
this.loadingDistricts = false;
|
|
1040
|
+
if (isSA && regionId != null) {
|
|
1041
|
+
const region = this.regions.find((r) => String(r.id) === String(regionId));
|
|
1042
|
+
if (region) {
|
|
1043
|
+
this.selectedRegion = region;
|
|
1044
|
+
this.updateNewAddressForm({ region_id: region.id });
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (cityId != null && this.cities.length > 0) {
|
|
1048
|
+
const city = this.cities.find((c) => String(c.id) === String(cityId));
|
|
1049
|
+
if (city) {
|
|
1050
|
+
this.selectedCity = city;
|
|
1051
|
+
this.updateNewAddressForm({ city_id: city.id, city });
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
if (districtId != null && this.districts.length > 0) {
|
|
1055
|
+
const district = this.findPrefillDistrict(districtId);
|
|
1056
|
+
if (district) {
|
|
1057
|
+
this.selectedDistrict = district;
|
|
1058
|
+
this.updateNewAddressForm({
|
|
1059
|
+
district_id: district.id,
|
|
1060
|
+
district,
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
770
1064
|
}
|
|
771
1065
|
async loadCities(countryId, regionId) {
|
|
772
1066
|
this.loadingCities = true;
|
|
773
1067
|
this.cities = [];
|
|
1068
|
+
this.displayedCities = [];
|
|
774
1069
|
this.districts = [];
|
|
1070
|
+
this.displayedDistricts = [];
|
|
775
1071
|
this.selectedCity = null;
|
|
776
1072
|
this.selectedDistrict = null;
|
|
777
1073
|
this.districtName = "";
|
|
778
1074
|
try {
|
|
779
1075
|
this.cities = await bulletDeliveryAPI.getCities(countryId, regionId);
|
|
1076
|
+
this.displayedCities = this.cities;
|
|
780
1077
|
}
|
|
781
1078
|
finally {
|
|
782
1079
|
this.loadingCities = false;
|
|
@@ -785,10 +1082,12 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
785
1082
|
async loadDistricts(cityId) {
|
|
786
1083
|
this.loadingDistricts = true;
|
|
787
1084
|
this.districts = [];
|
|
1085
|
+
this.displayedDistricts = [];
|
|
788
1086
|
this.selectedDistrict = null;
|
|
789
1087
|
this.districtName = "";
|
|
790
1088
|
try {
|
|
791
1089
|
this.districts = await bulletDeliveryAPI.getDistricts(cityId);
|
|
1090
|
+
this.displayedDistricts = this.districts;
|
|
792
1091
|
}
|
|
793
1092
|
finally {
|
|
794
1093
|
this.loadingDistricts = false;
|
|
@@ -869,7 +1168,6 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
869
1168
|
}
|
|
870
1169
|
async loadSavedAddresses() {
|
|
871
1170
|
this.savedAddresses = await bulletDeliveryAPI.getSavedAddresses();
|
|
872
|
-
// If session address exists (guest intent before login), select it by default
|
|
873
1171
|
const intent = this.getStoredIntent();
|
|
874
1172
|
const hasSessionAddress = hasSessionAddressIntent(intent);
|
|
875
1173
|
if (hasSessionAddress) {
|
|
@@ -877,13 +1175,11 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
877
1175
|
this.selectedSavedAddress = null;
|
|
878
1176
|
}
|
|
879
1177
|
else {
|
|
880
|
-
// Select default address if available and valid
|
|
881
1178
|
const defaultAddress = this.savedAddresses.find((a) => a.is_default && a.is_in_coverage !== false);
|
|
882
1179
|
if (defaultAddress) {
|
|
883
1180
|
this.selectedSavedAddress = defaultAddress;
|
|
884
1181
|
}
|
|
885
1182
|
else {
|
|
886
|
-
// Select first valid address
|
|
887
1183
|
const validAddress = this.savedAddresses.find((a) => a.is_in_coverage !== false);
|
|
888
1184
|
if (validAddress) {
|
|
889
1185
|
this.selectedSavedAddress = validAddress;
|
|
@@ -895,12 +1191,22 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
895
1191
|
this.selectedCountry = newCountry;
|
|
896
1192
|
this.selectedRegion = null;
|
|
897
1193
|
this.regions = [];
|
|
1194
|
+
this.displayedRegions = [];
|
|
898
1195
|
this.cities = [];
|
|
1196
|
+
this.displayedCities = [];
|
|
899
1197
|
this.districts = [];
|
|
1198
|
+
this.displayedDistricts = [];
|
|
900
1199
|
this.selectedCity = null;
|
|
901
1200
|
this.selectedDistrict = null;
|
|
902
1201
|
this.districtName = "";
|
|
903
1202
|
this.allocationOutOfCoverageMessage = null;
|
|
1203
|
+
this.regionSearchQuery = '';
|
|
1204
|
+
this.citySearchQuery = '';
|
|
1205
|
+
this.districtSearchQuery = '';
|
|
1206
|
+
this.searchingRegions = false;
|
|
1207
|
+
this.searchingCities = false;
|
|
1208
|
+
this.searchingDistricts = false;
|
|
1209
|
+
this.clearSearchTimers();
|
|
904
1210
|
if (this.selectedCountry) {
|
|
905
1211
|
this.updateNewAddressForm({
|
|
906
1212
|
country_id: Number(this.selectedCountry.id),
|
|
@@ -924,14 +1230,18 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
924
1230
|
async loadRegions(countryId) {
|
|
925
1231
|
this.loadingRegions = true;
|
|
926
1232
|
this.regions = [];
|
|
1233
|
+
this.displayedRegions = [];
|
|
927
1234
|
this.selectedRegion = null;
|
|
928
1235
|
this.cities = [];
|
|
1236
|
+
this.displayedCities = [];
|
|
929
1237
|
this.districts = [];
|
|
1238
|
+
this.displayedDistricts = [];
|
|
930
1239
|
this.selectedCity = null;
|
|
931
1240
|
this.selectedDistrict = null;
|
|
932
1241
|
this.districtName = "";
|
|
933
1242
|
try {
|
|
934
1243
|
this.regions = await bulletDeliveryAPI.getRegions(countryId);
|
|
1244
|
+
this.displayedRegions = this.regions;
|
|
935
1245
|
}
|
|
936
1246
|
finally {
|
|
937
1247
|
this.loadingRegions = false;
|
|
@@ -1008,6 +1318,29 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1008
1318
|
}
|
|
1009
1319
|
}, BRANCH_SEARCH_DEBOUNCE_MS);
|
|
1010
1320
|
}
|
|
1321
|
+
clearSearchTimers() {
|
|
1322
|
+
[this.countrySearchTimer, this.regionSearchTimer, this.citySearchTimer, this.districtSearchTimer]
|
|
1323
|
+
.forEach(t => {
|
|
1324
|
+
if (t)
|
|
1325
|
+
clearTimeout(t);
|
|
1326
|
+
});
|
|
1327
|
+
this.countrySearchTimer = this.regionSearchTimer = this.citySearchTimer = this.districtSearchTimer = null;
|
|
1328
|
+
}
|
|
1329
|
+
resetSearchState() {
|
|
1330
|
+
this.countrySearchQuery = '';
|
|
1331
|
+
this.regionSearchQuery = '';
|
|
1332
|
+
this.citySearchQuery = '';
|
|
1333
|
+
this.districtSearchQuery = '';
|
|
1334
|
+
this.searchingCountries = false;
|
|
1335
|
+
this.searchingRegions = false;
|
|
1336
|
+
this.searchingCities = false;
|
|
1337
|
+
this.searchingDistricts = false;
|
|
1338
|
+
this.displayedCountries = [];
|
|
1339
|
+
this.displayedRegions = [];
|
|
1340
|
+
this.displayedCities = [];
|
|
1341
|
+
this.displayedDistricts = [];
|
|
1342
|
+
this.clearSearchTimers();
|
|
1343
|
+
}
|
|
1011
1344
|
async loadBranchesWithLocation(lat, lng) {
|
|
1012
1345
|
this.loadingBranches = true;
|
|
1013
1346
|
try {
|
|
@@ -1132,14 +1465,26 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1132
1465
|
this.activeTab = tab;
|
|
1133
1466
|
this.showCartWillBeClearedBanner = false;
|
|
1134
1467
|
this.allocationOutOfCoverageMessage = null;
|
|
1135
|
-
|
|
1468
|
+
this.resetSearchState();
|
|
1136
1469
|
const forBranch = tab === "branch";
|
|
1137
1470
|
this.countries = await bulletDeliveryAPI.getCountries(forBranch);
|
|
1471
|
+
this.displayedCountries = this.countries;
|
|
1138
1472
|
const previousCountryId = this.selectedCountry?.id;
|
|
1139
1473
|
if (previousCountryId !== undefined && previousCountryId !== null) {
|
|
1140
1474
|
this.selectedCountry =
|
|
1141
1475
|
this.countries.find((c) => c.id === previousCountryId) || null;
|
|
1142
1476
|
}
|
|
1477
|
+
// Fallback to IP-detected country when carry-over fails
|
|
1478
|
+
if (!this.selectedCountry) {
|
|
1479
|
+
const { countryId: configCountryId } = this.getIPLocationConfig();
|
|
1480
|
+
if (configCountryId && this.countries.length > 0) {
|
|
1481
|
+
this.selectedCountry =
|
|
1482
|
+
this.countries.find((c) => String(c.id) === String(configCountryId)) || null;
|
|
1483
|
+
}
|
|
1484
|
+
if (!this.selectedCountry && this.countries.length === 1) {
|
|
1485
|
+
this.selectedCountry = this.countries[0];
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1143
1488
|
// Load appropriate data when switching tabs if country is selected
|
|
1144
1489
|
if (this.selectedCountry) {
|
|
1145
1490
|
if (tab === "branch") {
|
|
@@ -1389,7 +1734,6 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1389
1734
|
(this.activeTab === "address"
|
|
1390
1735
|
? Salla.lang.get("pages.checkout.address_out_of_coverage")
|
|
1391
1736
|
: Salla.lang.get("pages.checkout.failed_to_set_pickup"));
|
|
1392
|
-
Salla.notify?.error(errorMessage);
|
|
1393
1737
|
this.allocationOutOfCoverageMessage = errorMessage;
|
|
1394
1738
|
this.confirmBtn?.stop();
|
|
1395
1739
|
this.confirming = false;
|
|
@@ -1434,6 +1778,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1434
1778
|
this.setStoredIntent(result);
|
|
1435
1779
|
if (allocatedScopeId) {
|
|
1436
1780
|
await bulletDeliveryAPI.setDeliveryScope(allocatedScopeId);
|
|
1781
|
+
clearApiCache();
|
|
1437
1782
|
}
|
|
1438
1783
|
const allocationConfirmedPayload = {
|
|
1439
1784
|
...result,
|
|
@@ -1536,12 +1881,6 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1536
1881
|
wrapper.append(info, btn);
|
|
1537
1882
|
return wrapper;
|
|
1538
1883
|
}
|
|
1539
|
-
renderSkeleton() {
|
|
1540
|
-
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: {
|
|
1541
|
-
"s-bullet-delivery-skeleton-tabs": true,
|
|
1542
|
-
"s-bullet-delivery-skeleton-tabs--single": !this.supportsPickup,
|
|
1543
|
-
} }, 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%" }))));
|
|
1544
|
-
}
|
|
1545
1884
|
renderTabs() {
|
|
1546
1885
|
// Show tabs only when pickup is supported; otherwise delivery-only view with no tabs
|
|
1547
1886
|
if (!this.supportsPickup)
|
|
@@ -1563,56 +1902,22 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1563
1902
|
return this.renderAlert(message);
|
|
1564
1903
|
}
|
|
1565
1904
|
renderCountrySelect() {
|
|
1566
|
-
return (h("div", { class: "s-bullet-delivery-field" }, h("
|
|
1567
|
-
const select = e.target;
|
|
1568
|
-
const countryId = Number.parseInt(select.value);
|
|
1569
|
-
const country = this.countries.find((c) => c.id === countryId);
|
|
1570
|
-
// A "switch" means the user already had a country and picked a different one
|
|
1571
|
-
const isCountrySwitch = this.selectedCountry &&
|
|
1572
|
-
country &&
|
|
1573
|
-
this.selectedCountry.code !== country.code;
|
|
1574
|
-
// Show the info banner whenever a country is changed to a different one
|
|
1575
|
-
this.showCartWillBeClearedBanner = !!isCountrySwitch;
|
|
1576
|
-
this.applyCountryChange(country || null);
|
|
1577
|
-
} }, 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))))));
|
|
1578
|
-
}
|
|
1579
|
-
renderSelectLoader() {
|
|
1580
|
-
return (h("span", { class: "s-bullet-delivery-select-loader", "aria-hidden": "true" }, h("salla-skeleton", { height: "16px", width: "16px" })));
|
|
1581
|
-
}
|
|
1582
|
-
renderLoadingLabel(label, htmlFor, isLoading = false, isRequired = true) {
|
|
1583
|
-
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())));
|
|
1905
|
+
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() })));
|
|
1584
1906
|
}
|
|
1585
1907
|
/** Region select (SA only): shown when SA is selected; city and district disabled until region selected. */
|
|
1586
1908
|
renderRegionSelect() {
|
|
1587
1909
|
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
1588
1910
|
if (!isSA || !this.selectedCountry)
|
|
1589
1911
|
return null;
|
|
1590
|
-
return (h("div", { class: "s-bullet-delivery-field" },
|
|
1591
|
-
const select = e.target;
|
|
1592
|
-
const regionId = Number.parseInt(select.value);
|
|
1593
|
-
const region = this.regions.find((r) => r.id === regionId);
|
|
1594
|
-
this.selectedRegion = region || null;
|
|
1595
|
-
this.updateNewAddressForm({
|
|
1596
|
-
region_id: region?.id,
|
|
1597
|
-
city_id: undefined,
|
|
1598
|
-
district_id: undefined,
|
|
1599
|
-
city: undefined,
|
|
1600
|
-
district: undefined,
|
|
1601
|
-
});
|
|
1602
|
-
if (region && this.selectedCountry) {
|
|
1603
|
-
this.loadCities(this.selectedCountry.id, region.id);
|
|
1604
|
-
}
|
|
1605
|
-
} }, 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))))));
|
|
1912
|
+
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() })));
|
|
1606
1913
|
}
|
|
1607
1914
|
renderCityDistrictSelects() {
|
|
1608
|
-
// Guest form: region + district only for SA; other countries get country + city only
|
|
1609
1915
|
const isSA = isSaudiArabia(this.selectedCountry?.code ?? '');
|
|
1610
1916
|
const showDistrict = isSA;
|
|
1611
1917
|
const showDistrictInput = showDistrict &&
|
|
1612
1918
|
this.selectedCity &&
|
|
1613
1919
|
!this.loadingDistricts &&
|
|
1614
1920
|
this.districts.length === 0;
|
|
1615
|
-
// For SA: city disabled until region selected; for non-SA: city disabled until country selected
|
|
1616
1921
|
const cityDisabled = !this.selectedCountry ||
|
|
1617
1922
|
(isSA && !this.selectedRegion) ||
|
|
1618
1923
|
this.loadingCities ||
|
|
@@ -1621,39 +1926,11 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1621
1926
|
(isSA && !this.selectedRegion) ||
|
|
1622
1927
|
!this.selectedCity ||
|
|
1623
1928
|
this.loadingDistricts;
|
|
1624
|
-
return (h("div", { class: "s-bullet-delivery-field-row" }, h("div", { class: "s-bullet-delivery-field" },
|
|
1625
|
-
const select = e.target;
|
|
1626
|
-
const cityId = Number.parseInt(select.value);
|
|
1627
|
-
const city = this.cities.find((c) => c.id === cityId);
|
|
1628
|
-
this.selectedCity = city || null;
|
|
1629
|
-
this.selectedDistrict = null;
|
|
1630
|
-
this.districtName = "";
|
|
1631
|
-
if (city) {
|
|
1632
|
-
this.updateNewAddressForm({ city: city, district: undefined });
|
|
1633
|
-
if (showDistrict) {
|
|
1634
|
-
this.loadDistricts(city.id);
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
} }, 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) => {
|
|
1929
|
+
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) => {
|
|
1638
1930
|
const input = e.target;
|
|
1639
1931
|
this.districtName = input.value;
|
|
1640
1932
|
this.updateNewAddressForm({ district: undefined });
|
|
1641
|
-
} })) : (h("
|
|
1642
|
-
const select = e.target;
|
|
1643
|
-
const districtId = Number.parseInt(select.value);
|
|
1644
|
-
const district = this.districts.find((d) => d.id === districtId);
|
|
1645
|
-
this.selectedDistrict = district || null;
|
|
1646
|
-
this.districtName = "";
|
|
1647
|
-
if (district) {
|
|
1648
|
-
this.updateNewAddressForm({ district });
|
|
1649
|
-
}
|
|
1650
|
-
} }, h("option", { value: "", disabled: true, selected: !this.selectedDistrict }, Salla.lang.get("pages.checkout.select_district")), this.districts.map((district) => {
|
|
1651
|
-
const langCode = Salla.config.get("user.language_code");
|
|
1652
|
-
const label = langCode === "ar"
|
|
1653
|
-
? district.name
|
|
1654
|
-
: (district.name_en ?? district.name);
|
|
1655
|
-
return (h("option", { key: district.id, value: district.id, selected: this.selectedDistrict?.id === district.id }, label));
|
|
1656
|
-
})))))));
|
|
1933
|
+
} }))) : (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 }))))));
|
|
1657
1934
|
}
|
|
1658
1935
|
renderSavedAddressesEmptyState() {
|
|
1659
1936
|
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"))));
|
|
@@ -1829,7 +2106,8 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1829
2106
|
const submitLabel = this.savingAddress
|
|
1830
2107
|
? Salla.lang.get("pages.checkout.loading")
|
|
1831
2108
|
: Salla.lang.get("pages.checkout.confirm_address");
|
|
1832
|
-
|
|
2109
|
+
const hasAddressesToGoBack = this.savedAddresses.length > 0 || hasSessionAddressIntent(this.getStoredIntent());
|
|
2110
|
+
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 ? KeyBoardArrowRightIcon : KeyBoardArrowLeftIcon, "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)))));
|
|
1833
2111
|
}
|
|
1834
2112
|
renderFooter() {
|
|
1835
2113
|
const showAddAddressInFooter = this.activeTab === "address" && this.isLoggedIn;
|
|
@@ -1972,9 +2250,9 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
1972
2250
|
}
|
|
1973
2251
|
}
|
|
1974
2252
|
render() {
|
|
1975
|
-
return (h(Host, { key: '
|
|
2253
|
+
return (h(Host, { key: '0daead232faa6590712faef140ab694b3324960e', class: "s-bullet-delivery" }, h("salla-modal", { key: '4f318a88c10b524d5f6b71a46cb93535d4b25a82', ref: (modal) => {
|
|
1976
2254
|
this.modal = modal;
|
|
1977
|
-
}, isClosable: !this.isRequired && !this.shouldForceNonClosable(), class: "s-bullet-delivery-modal",
|
|
2255
|
+
}, 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()))));
|
|
1978
2256
|
}
|
|
1979
2257
|
componentDidLoad() {
|
|
1980
2258
|
// Mark component as ready
|
|
@@ -2059,7 +2337,6 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
2059
2337
|
}
|
|
2060
2338
|
static get style() { return sallaBulletDeliveryCss; }
|
|
2061
2339
|
}, [0, "salla-bullet-delivery", {
|
|
2062
|
-
"loading": [32],
|
|
2063
2340
|
"activeTab": [32],
|
|
2064
2341
|
"isLoggedIn": [32],
|
|
2065
2342
|
"viewMode": [32],
|
|
@@ -2080,6 +2357,7 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
2080
2357
|
"filteredBranches": [32],
|
|
2081
2358
|
"selectedBranch": [32],
|
|
2082
2359
|
"branchSearchQuery": [32],
|
|
2360
|
+
"loadingCountries": [32],
|
|
2083
2361
|
"loadingCities": [32],
|
|
2084
2362
|
"loadingDistricts": [32],
|
|
2085
2363
|
"loadingBranches": [32],
|
|
@@ -2088,6 +2366,18 @@ const SallaBulletDelivery$1 = /*@__PURE__*/ proxyCustomElement(class SallaBullet
|
|
|
2088
2366
|
"savingAddress": [32],
|
|
2089
2367
|
"loadingSavedAddresses": [32],
|
|
2090
2368
|
"showCartWillBeClearedBanner": [32],
|
|
2369
|
+
"countrySearchQuery": [32],
|
|
2370
|
+
"regionSearchQuery": [32],
|
|
2371
|
+
"citySearchQuery": [32],
|
|
2372
|
+
"districtSearchQuery": [32],
|
|
2373
|
+
"searchingCountries": [32],
|
|
2374
|
+
"searchingRegions": [32],
|
|
2375
|
+
"searchingCities": [32],
|
|
2376
|
+
"searchingDistricts": [32],
|
|
2377
|
+
"displayedCountries": [32],
|
|
2378
|
+
"displayedRegions": [32],
|
|
2379
|
+
"displayedCities": [32],
|
|
2380
|
+
"displayedDistricts": [32],
|
|
2091
2381
|
"allocationOutOfCoverageMessage": [32],
|
|
2092
2382
|
"newAddressForm": [32],
|
|
2093
2383
|
"open": [64],
|
|
@@ -2108,11 +2398,13 @@ SallaBulletDelivery$1.INITIAL_ADDRESS_FORM = {
|
|
|
2108
2398
|
postal_code: undefined,
|
|
2109
2399
|
description: undefined,
|
|
2110
2400
|
};
|
|
2401
|
+
SallaBulletDelivery$1.DROPDOWN_SEARCH_DEBOUNCE_MS = 400;
|
|
2402
|
+
SallaBulletDelivery$1.DROPDOWN_SEARCH_MIN_CHARS = 2;
|
|
2111
2403
|
function defineCustomElement$1() {
|
|
2112
2404
|
if (typeof customElements === "undefined") {
|
|
2113
2405
|
return;
|
|
2114
2406
|
}
|
|
2115
|
-
const components = ["salla-bullet-delivery", "salla-button", "salla-loading", "salla-modal", "salla-placeholder", "salla-skeleton"];
|
|
2407
|
+
const components = ["salla-bullet-delivery", "salla-button", "salla-loading", "salla-modal", "salla-placeholder", "salla-searchable-dropdown", "salla-skeleton"];
|
|
2116
2408
|
components.forEach(tagName => { switch (tagName) {
|
|
2117
2409
|
case "salla-bullet-delivery":
|
|
2118
2410
|
if (!customElements.get(tagName)) {
|
|
@@ -2121,20 +2413,25 @@ function defineCustomElement$1() {
|
|
|
2121
2413
|
break;
|
|
2122
2414
|
case "salla-button":
|
|
2123
2415
|
if (!customElements.get(tagName)) {
|
|
2124
|
-
defineCustomElement$
|
|
2416
|
+
defineCustomElement$7();
|
|
2125
2417
|
}
|
|
2126
2418
|
break;
|
|
2127
2419
|
case "salla-loading":
|
|
2128
2420
|
if (!customElements.get(tagName)) {
|
|
2129
|
-
defineCustomElement$
|
|
2421
|
+
defineCustomElement$6();
|
|
2130
2422
|
}
|
|
2131
2423
|
break;
|
|
2132
2424
|
case "salla-modal":
|
|
2133
2425
|
if (!customElements.get(tagName)) {
|
|
2134
|
-
defineCustomElement$
|
|
2426
|
+
defineCustomElement$5();
|
|
2135
2427
|
}
|
|
2136
2428
|
break;
|
|
2137
2429
|
case "salla-placeholder":
|
|
2430
|
+
if (!customElements.get(tagName)) {
|
|
2431
|
+
defineCustomElement$4();
|
|
2432
|
+
}
|
|
2433
|
+
break;
|
|
2434
|
+
case "salla-searchable-dropdown":
|
|
2138
2435
|
if (!customElements.get(tagName)) {
|
|
2139
2436
|
defineCustomElement$3();
|
|
2140
2437
|
}
|